I want to compress the uploaded image and store the base64 of the image in the database. Every time I google the question I always gets the idea to use the image stored in a certain path. I'm using intervention/image
package
I have tried this code
$img = Image::make($request->photo)->resize(300, 200);
//get the extension
$type = $request->file('photo')->getClientOriginalExtension();
//convert it into the base64.
$base64 = 'data:image/' . $type . ';base64,' . base64_encode(file_get_contents($img));
I want to store the photo in the database after compressing and converting into the base64 format. Error that I got