I have this code:
$image = imagecreatefromjpeg($filename);
$size = getimagesize($filename, $info);
var_dump($image);
var_dump($size);
And I receive this output:
Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error
Warning: imagecreatefromjpeg(): 'my_image.jpg' is not a valid JPEG file
bool(false)
array(7) {
[0]=>
int(22)
[1]=>
int(30)
[2]=>
int(2)
[3]=>
string(22) "width="22" height="30""
["bits"]=>
int(8)
["channels"]=>
int(3)
["mime"]=>
string(10) "image/jpeg"
}
I got warn, that image is not a valid JPEG file and don't load that file, but getimagesize says that is JPEG file (mime type). What is happening and how can I fix this?
I tried this, but it didn't help me:
- check *memory_limit* in php.ini
- check space in the disk
- set *gd.jpeg_ignore_warning*
Interestingly, on the local server everything works good (with the same image of course).