Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotReadableException in Decoder.php line 46: #669

Closed
ezekel opened this issue Jan 19, 2017 · 10 comments
Closed

NotReadableException in Decoder.php line 46: #669

ezekel opened this issue Jan 19, 2017 · 10 comments

Comments

@ezekel
Copy link

ezekel commented Jan 19, 2017

@olivervogel

I have image from my mobile phone, when I tried to upload in our web server using Laravel, it threw error

NotReadableException in Decoder.php line 46:
Unable to read image from file

this is my code

       $filename = $request->upimg->getClientOriginalName();
        $image = $request->upimg->getRealPath();
        $path =public_path() . '/userimg/';
        $fimage = Image::make($image)->resize(48, null,true);
        $fimage->save($path . $filename);

But when i open the image in the paint and save as . I can upload in the server, but I don't want my users to open in paint and do save as in order to upload their profile pic.

Thank you in advance.

@olivervogel
Copy link
Member

Please provide a link to a not working image.

@andrew-za
Copy link

Same here - any image I have on my phone..

@matthewnessworthy
Copy link

are you correctly encoding the post data? e.g., <form enctype="multipart/form-data">

@LechuuuS
Copy link

LechuuuS commented Apr 15, 2017

I also have the same problem

Link to image: https://drive.google.com/file/d/0B8XyZGhUQfVsRVQ5MEZ2cmtZZVU/view?usp=sharing

@jqhnmaina
Copy link

In my case, random image were were not working first thought it was memory issues but it wasn't, it worked after the following lines before reading image data with any intervention image function

ini_set ('gd.jpeg_ignore_warning', 1); error_reporting(E_ALL & ~E_NOTICE);

@LechuuuS
Copy link

LechuuuS commented May 3, 2017

JOHN-MAINA, thank you for the solution, actually after adding this configuration it works perfectly. Regards :)

@Mr-Anonymous
Copy link

Hi @John-Maina Thank you for sharing your solution. I am stuck on the same problem and it is very odd. Like you pointed out, the unable to read image from file error happens only randomly and I am unable to reproduce that error. however i can see from laravel error log that this error is happening to some users who are using android chrome and even firefox on windows 7. So my question to your post, did you add that ini_set() and error_reporting() code 1 line before $img = Image::make($file); code in my controller?

Do you know why this line of code fixes the issue? It appears the line of code is related to error reporting, but why does that make the Image::make($file); work properly?

Its very odd, I have seen many posts on the same issue but with no concrete solution. Hope you can share a little bit more info on this please...

@jqhnmaina
Copy link

@Mr-Anonymous
Added it before
It turns off error reporting during runtime caused by JPEG images

@nfreear
Copy link

nfreear commented Jun 29, 2018

Hi All,

In case it's useful to anyone ...

I've just seen the same exception on a Redhat Linux production server, which I wasn't seeing on our approval server (on the face of it, identical installations / configurations ...)

When I enabled the Laravel debug-bar, I was able to see the underlying ImagickException:

no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/504
/var/www/.../vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php#28
ImagickException

I was also able to see on a phpinfo(); web-page, under the "imagick" section:

ImageMagick number of supported formats: 0

(It should be a non-zero number!)

I think the cause was an automated upgrade of the imagick libraries ... The solution was to re-start the php-fpm service.

I hope this helps.

Nick

@olivervogel
Copy link
Member

Please note that not all image formats are always included in the PHP image extensions. It is therefore possible, that the GD library is installed but is configured without Jpeg support or Imagick is available without Webp support for example.

You can view the supported image formats with gd_info() or Imagick::queryFormats()

It may then be necessary to configure the respective support for the corresponding image format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants