you are passing a string. change this part of code like this and try Image::make($request->file('file_name'))
Mar 26, 2019
5
Level 1
Image Intervention
Hi Everyone,
Can you help me with this problem? Unable to decode image from file
And I got this exception Intervention\Image\Exception\NotReadableException
Im using Image Intervention package to process thumbnail size images. It is working with smaller images but it seems that error/exception appearing if images are 180mb+.
Im using those configuration to manipulate php_ini configs.
php_value upload_max_filesize 800M
php_value post_max_size 1000M
php_value memory_limit 10800M
php_value max_execution_time 3600
I wil also share my test code.
//get filename with extension
$filenamewithextension = $request->file('file_name')->getClientOriginalName();
//get filename without extension
$filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);
//get file extension
$extension = $request->file('file_name')->getClientOriginalExtension();
//filename to store
$filenametostore = $filename.'_'.time().'.'.$extension;
$request->file('file_name')->storeAs('public/thumbnail', $filenametostore);
//Resize image here
$thumbnailpath = public_path('storage/thumbnail/'.$filenametostore);
$img = Image::make($thumbnailpath)
->resize(400, 150, function($constraint) {
$constraint->aspectRatio();
});
$img->save($thumbnailpath);
return response('Successfully Uploaded', 200);
Any suggestions are highly appreciated! Thank you!
Please or to participate in this conversation.