Marcus Börger wrote: > The advantage is that this would retrieve the correct size even for gifs > with multiple images. On the other hand the disadvantage is speed loss.
I've been giving this some thought. Shouldn't getimagesize() just return false if the "actual size" (the largest size found in any of the image blocks) differs from the size reported in the Logical Screen Descriptor (LSD)? I mean, it could just report the biggest size it encounters, but the image is by all means corrupt and when a browser tries to render it, the results are, to say the least, unpredictable. I just tried messing with the values a bit and I was wrong in my initial assumption that only IE renders it "incorrectly" - the problem occurs in Mozilla and Opera as well. My suggestion would be to rewrite php_handle_gif() so that it does the following: 1. Fetch width/height from the LSD (as it does now). 2. Loop through all Image Descriptors and obtain the largest values for width/height. 3. If the sizes differ, return null, otherwise return width/height from the LSD (as it does now). The problem is that step 2 requires quite a lot of seeking and reading due to the nature of the GIF file format. How big this speed loss will be I can't say, but I'm gonna give it a go when I get the time (probably not until this weekend I'm afraid). If it's a big speed loss perhaps Sebastians idea isn't so bad. BTW. I'm kinda new to contributing to large projects as this one. Should I checkout the latest CVS and patch agains that or should I use some other base for my alterations? /Rickard -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php