Jan 17, 2019
0
Level 1
Intervention\Image\Exception\NotReadableException
Hi I want to upload an image but I encounter this error
Error Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files
Request
product_desc: "Sample 111"
product_image: "adviser.jpg"
product_name: "Sample 1"
product_price: "10"
product_stock: "12"
product_tag: "Sample 111"
This is my controller.
$name = str_random(20) . time() . '.jpg';
$base64 = substr($request->product_image, strpos($request->product_image,',')+1);
// This saves the base64encoded destinationPath
file_put_contents( public_path() . '/uploads/' . $name, base64_decode($base64) );
$file = public_path() . '/uploads/' . $name;
$thumb = 'thumb_' . $name;
$image = Image::make($file)->encode('jpg')->orientate()->fit(200)->save(public_path() . '/uploads/' . $thumb);
$prod_picture = '/uploads/' . $name;
Please or to participate in this conversation.