I'm using intervention/image 2.3
. When I try to upload an image I got the following error :
InvalidArgumentException in AbstractEncoder.php line 212
Quality must range from 0 to 100
Below is my code for that :
$file = Input::file('image');
$filename = time() . '.' . $file->getClientOriginalExtension();
Image::make($file)->resize(50, 50)->save(storage_path() . DIRECTORY_SEPARATOR . 'uploads', $filename);
Any single guidance will help me alot. According to this URL I tried out to pass second optional parameter ie quality but didn't work. I tried even
Image::make($file)->resize(50, 50)->save(storage_path() . DIRECTORY_SEPARATOR . 'uploads'. $filename, 50);
I have faced this problem, and I solved it by the following code:
$file = $request->file('img_profile');
$file_name = date('Ymd-his').'.png';
$destinationPath = 'uploads/images/';
$new_img = Image::make($file->getRealPath())->resize(400, 300);
// save file with medium quality
$new_img->save($destinationPath . $file_name, 80);
Check http://image.intervention.io/api/save for more...
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