Saturday, July 12, 2008

PHP: Get the image height and width

There is a function getimagesize() at PHP which takes the file name as parameter, and returns a list that contains four values. The values are image width, image height, image type, and image attributes.

Here is the small piece of example how to use the function getimagesize(), you can check for more about the function from your php manual.
// point your image file
$file_name = "img.jpg";

// get the image information using getimagesize function.
list($img_width, $img_height, $img_type, $img_attr) = getimagesize($file_name);
print "$img_width, $img_height, $img_type, $img_attr\n";

If you are interested to know more about PHP, you can read from my blog. Here it is

No comments:

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...