There is a builtin function in php to get the width and height of an image. The getimagesize()function determines the size of image also including flash file(swf).
Here is the code to get basic information such as width, height, type and attribute of any image
<?php
list($width, $height, $type, $attr) = getimagesize("you_image.jpg");
echo "Image width " .$width."\n";
echo "Image height " .$height."\n";
echo "Image type " .$type."\n";
echo "Attribute " .$attr."\n";
?>
Output
Image width 749
Image height 695
Image type 2
Attribute width="749" height="695"
so this is the way to get the width and height of any image in php.
Type of the image
1 = GIF
2 = JPG
3 = PNG
4 = SWF
5 = PSD
6 = BMP
7 = TIFF(intel byte order)
8 = TIFF(motorola byte order)
9 = JPC
10 = JP2
11 = JPX
12 = JB2
13 = SWC
14 = IFF
15 = WBMP
16 = XBM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment