Sometime we have to get the uploaded image name from database. But we don’t know the image width and height. Width and height may be variable. But we want to know the actual width and height of an image. We can use getimagesize() PHP function to get the width and height of an image.
array getimagesize ( string $filename [, array &$imageinfo ] )
This function returns an array of 7 elements. Index 0 and 1 contains respectively the width and the height of the image.
Example:
<?php
$image_Name = ‘ekram.jpg’;
list($width, $height) = getimagesize($image_Name);
echo “<img src=’$image_Name’ width=’$width’ height=’$height’ />”;
?>