Output image tag : HTML « HTML « PHP






Output image tag

 
function html_img($url, $alt = '', $height = 0, $width = 0) {
    print '<img src="' . $url . '"';
    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 with global path value
9.The Header