Friday, May 21, 2010

Is it possible to use PHP to get the dememsions of an image?

I've set up a PHP-based wallpaper gallery and some of the images are 600x800 in size and others are 1024x768. The pages are all dynamically generated, but it would be nice to show the user, before they click, what filesize the image is. Here's one example page:


http://www.mzanime.com/aw/naruto/





Currently it justs shows the name of the thumbnail, but thats not what I want it to show.

Is it possible to use PHP to get the dememsions of an image?
array getimagesize ( string filename [, array %26amp;imageinfo] )





It DOESN'T require the GD library. The array it returns consists of:





[0] = width


[1] = height


[2] = type flag:


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


[3] = HTML height and width tags





And there's other stuff. Check it out at http://www.php.net/
Reply:Absolutely!





If your service provider has the GD library installed (I'd be surprised if they didn't), you can use the getImageSize function. It is simple to use - the documentation can be found here...





http://ca3.php.net/manual/en/function.ge...





Good Luck!

eurovision song contest

No comments:

Post a Comment