Output image tag with global path value : HTML « HTML « PHP






Output image tag with global path value

 
function html_img2($file, $alt = '', $height = 0, $width = 0) {

    print '<img src="' . $GLOBALS['image_path'] . $file . '"';
    if (strlen($alt)) {
        print ' alt="' . $alt . '"';
    }
    if ($height) {
        print ' height="' . $height . '"';
    }
    if ($width) {
        print ' width="' . $width . '"';
    }
    print '>';
}
  
  








Related examples in the same category

1.Display of HTML using PHP code
2.Dynamic Generation of Tags from an Array
3.Dynamic HTML tags
4.Dynamic PHP page creation
5.Dynamic date insertion
6.Example: Creating an XHTML document from PHP
7.Output Control
8.Output image tag
9.The Header