Social Icons

twitterfacebookgoogle pluslinkedinemail

Tuesday 13 August 2013

Get the width and height of an image using a function in PHP

<?php

list($width,$height,$type,$attr) = getimagesize("image_name.jpg");

echo "image width " . $width;
echo "<br>";
echo "image height " .$height;
echo "<br>";
echo "image type " .$type;
echo "<br>";
echo "image attribute". $attr;
?>



list function is  Assign variables as if they were an array.
list() is used to a assign list of variables in one operation.

getimagesize() is return the size of image.

The getsizeimage() will determine the size of given image file and return the dimensions along with the file type and a height/width text string to be used inside
a normal HTML IMG tag and the correspondent HTTP content type.

getsizeinfo() is also return the some more informaton in imageinfo parameter

No comments :

Post a Comment

 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement