After checked about 20 solutions I gave up and need help. I've got 2 JPG files. Both have proper mime, they are not too big for upload_max_filesize, names are ok, path is ok. Every solution was about one of those issues.
My problem is when I run script on first image it is ok, no error, object is created:
$image1 = Image::make(public_path()."/uploads/goodimage.jpg");
See example: https://app.esticrm.pl/uploads/goodimage.jpg
When I run it on other picture I'm getting error:
$image2 = Image::make(public_path()."/uploads/badimage.jpg");
See example: https://app.esticrm.pl/uploads/badimage.jpg
Error message:
Intervention \ Image \ Exception \ NotReadableException Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files.
Same situation on Windows and Linux. Files are opening on every graphic program and browser I've checked. Those problems has started after PHP upgrade from 5.5.x to 5.6.35. Was fine before.
Ok, I found solution:
$image2 = Image::make(file_get_contents(public_path()."/uploads/badimage.jpg"));
Works also on file object from form:
$image2 = Image::make(file_get_contents(Input::file('upload_file'));
I had the same problem and my way of solving was the next. I had to change the size that nginx allowed the user to upload in /etc/nginx.conf, like this:
http {
client_max_body_size 100M;
}
And I had to change also my php.ini, to increase the size of the files uploaded and the total size:
upload_max_filesize = 4M
post_max_size = 16M
I hope helps someone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With