madprabh's avatar

Error while uploading image from certain computers - Intervention

Hello Friends,

I am using Intervention with Laravel for image processing and get the following error

[2017-09-21 23:18:18] local.ERROR: exception 'Intervention\Image\Exception\NotSupportedException' with message 'Encoding format (bin) is not supported.' in /var/www/thankingli/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php:163

And this doesn't happen on all the systems. For example I am using a Mac book pro and it works fine while the problem occurs when my friend uses her new Mac book pro to upload the same image.

Does anybody have any idea why might be wrong?

Here is my code that handles the image processing

if ($file = request()->file('image')) { $ext = $file->guessClientExtension(); $unique_name = md5($file);

                            $relativeUrl = $file->storeAs('thankingli-images/' . \Auth::id(),"$unique_name.{$ext}");
                            $imageFullLoc="$imageLoc"."$user_id/"."$unique_name.{$ext}";

                $image=Image::make($imageFullLoc);
                   
                                    $image->fit(400, 400)->save($imageFullLoc);

            
             

                    }

Code that validates for images

$this->validate(request(), [ 'name'=> 'required|max:40', 'email' => 'nullable|email', 'thank-title'=> 'required|max:100', 'thank-descr'=>'required|max:5000', 'image'=> 'nullable|image|mimes:jpeg,jpg,png|max:3000', 'emailpresent'=>'nullable', 'surprise' => 'nullable'

            ]);

Thanks, Madhu

0 likes
0 replies

Please or to participate in this conversation.