I have a website where the public can upload JPEGs.
Someone from the public was uploading an invalid JPEG that was causing the site to crash for them.
PHP said...
imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file
I wasn't sure how to get around this, so I Googled and found this site. It told me to add...
ini_set('gd.jpeg_ignore_warning', 1);
I added that in my index.php
(the bootstrap of my site, where I do other ini_set()
).
This didn't seem to fix it.
How can I handle this case of invalid JPEGs? Am I doing something wrong with the INI set? I'm on a shared host so I can't change php.ini
directly.
I'm using Kohana 2.3, and its Image library, but I don't think it is really relevant here.
Thanks