Verifying images with getimagesize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry to reply to this message but I wanted the OP to find it too...

On Jun 23, 2005, at 9:42 AM, Jack Jackson wrote:
[snip]

Through your help I was able to validate image files using getimagesize() and have made a nice script to upload and rename images.

[\snip]

I've been meaning to post a reply to a problem I ran into a while back that included validating images with getimagesize(). I've seen a few posts from folks saying this is the way to go and just want to share my experiences.

My original problem was that a script I had for batch generating thumbnails from uploaded images was running out of memory. With Richard Lynch's help I was able to track the problem to createimagefromjpeg() using an unholy amount of memory on one particular file, a file that had passed through getimagesize() with no problems. What I found was that if an image ( in this case a jpeg ) is corrupted, but just barely, getimagesize() will let it through. Just for the record I could open it up in Photoshop and that's how I discovered that it was corrupted, the last ten or fifteen rows on the image were gone. Photoshop showed an uncompressed file size of 11M for this image. But what I had to end up doing is setting my memory limit to 48M before createimagefromjpeg() could get enough memory to work with that it finally failed.

Just a heads up to anyone that's using getimagesize() to verify an image before running it through createimagefromjpeg(), just because it passes getimagesize() doesn't necessarily mean it's a good image.

Edward Vermillion
evermillion@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux