Re: this has got me baffled: imagesx() andimagesy()reporting the wrong size?
| From: | Jason Young | Date: | Mon, 16 Nov 2009 20:17:34 +0000 |
| Subject: | Re: this has got me baffled: imagesx() andimagesy()reporting the wrong size? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299873@lists.php.net to get a copy of this message | ||
Indeed. Using ImageMagick's 'identify' command, the first layer is 30x24 on a 32x32 canvas.
radioactive-bread-eek.gif[0] GIF 30x24 32x32+2+6 8-bit PseudoClass 256c 2.11kb
radioactive-bread-eek.gif[1] GIF 32x27 32x32+0+4 8-bit PseudoClass 256c 2.11kb
If getimagesize() works on the canvas, then you might want to use that, instead. gd and gifs don't really have a steady relationship, anyway.
Ashley Sheridan wrote:
It does indeed seem to be some sort of bug. I've just tested it with your image on my machine here and for imagesx() and imagesy() it gives 30 and 24 respectively. getimagesize() does return the correct dimensions though. The same image saved as a flat single layer gif from the Gimp behaves exactly the same way. This might not be a proper bug as such, as the image itself might be 32x32, but the first layer (the first frame in the animated version) is 30x24 when you remove the dead, unused, transparent background. Perhaps GD is meant to report on the *actual* size of the image, rather than the dimensions of the frame? Thanks, Ash http://www.ashleysheridan.co.uk