• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

Image file print function

In PHP you can automatically get width and height of image file, so you don't have to write it manually. You can use this function to output your image in HTML code:

function print_image($imagepath)
    $img_sizes = getimagesize($imagepath);
    $width = $img_sizes[0];
    $height = $img_sizes[1];
    echo "<img src='".$path."' ".
    "style='width:".$width."px; height:".$height."px' />";

You may also be interested in:

Powered by

blog comments powered by Disqus