I’m trying to load an image from an external site over which I have no control.
Most of the time it works fine (hundreds of images tested so far).
It’s now giving me this error for one particular image:
imagecreatefromstring(): gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: premature end of data segment
from this line:
$im = @imagecreatefromstring( $imageString );
The advice I’d read so far suggests adding:
ini_set("gd.jpeg_ignore_warning", true);
but that’s had no effect and I’m still getting the error. I’m doing the ini_set just before the call. Is that relevant?
I’m really stuck on how to ignore this error and carry on.
The problem was due to my error handling. I’d set up an error handler so my call to
wasn’t suppressing errors.
By modifying my error handler with:
I can now correctly suppress selected errors.
I found the info here: http://anvilstudios.co.za/blog/php/how-to-ignore-errors-in-a-custom-php-error-handler/