Return to Snippet

Revision: 7497
at July 26, 2008 18:49 by jamesming


Initial Code
<?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 "Attribute " .$attr;

?>

Initial URL
http://www.phpeasystep.com/workshopview.php?id=25

Initial Description
When you run this script you will see the result like this

Image width 379
Image height 344
Image type 2
Image attribute width="379" height="344"

You will get the width, height, type of an image and also attribute of an image, I use this function in my image upload form.

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

Initial Tags
image

Initial Language
PHP