Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




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:

<?php
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 BlogAlike.com

blog comments powered by Disqus