Error in creating JPEG image from source.

See all posts See thread Reply

Re: Error in creating JPEG image from source. new!
by dreamer, 12 years, 5 months ago
Dear colin ,thanks a lot.

My PHP Version 5.3.8 GD Version:bundled (2.0.34 compatible)

I try to run the code:

$src = imagecreatefromjpeg("sample.jpg");

It doesn't work and returns:

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 2478 extraneous bytes before marker 0xd9 in...

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'sample.jpg' is not a valid JPEG file in...

But the code works when I re-save the image(Size become 2.67M)

I am confused now.Reply
Re: Error in creating JPEG image from source. new!
by colin, 12 years, 5 months ago
It looks to me like the version of libjpeg on your system reports the file as being erroneous. GD, which uses libjpeg then discards the image as invalid.

I am not too sure how you could solve the problem, but in any case, it is a libjpeg/GD issue, and not a class issue. Try to update your system, or even downgrade libjpeg or GD (for instance, your files work on GD 2.0 on my box).Reply
Re: Error in creating JPEG image from source. new!
by Ahmet, 9 years, 10 months ago
problem !!!!

please helpReply