Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file" in Codeigniter

I am using CodeIgniter and trying to create thumbs of images. I was successful for some but failed for in some cases. I am getting this following error -

<< A PHP Error was encountered
Severity: Notice

Message: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file

Filename: libraries/Image_lib.php

Line Number: 1155 >>

i used this code after 'image_lib' library load.

ini_set('gd.jpeg_ignore_warning', 1);

any solution? Thanks in advance!

like image 864
rafi Avatar asked Feb 06 '13 17:02

rafi


1 Answers

Try Adding @imagecreatefromjpeg($img) instead of imagecreatefromjpeg($img)

here @ is error suppressor

like image 132
phpnerd Avatar answered Oct 13 '22 00:10

phpnerd