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’ />”;
?>
Thanks for this. It was really useful
Hey very very thanks for telling it ….. really I am searching for anything else but I also want this and I found it here very very thanks…. I used this at on my web