I'm trying to convery a base64 data into an image file and then rename it and store it to a specified location, below is my codes
//the first image to be saved, first, we get the extension
$extension = $request->file('image')->getClientOriginalExtension();
//second we rename the file
$fileName = rand(11111,99999).'_'.$request->id;
//and then move the file to a specified location with the new name
$request->file('image')->move(base_path().'/public/images/uploads/', $fileName.'.'.$extension);
//second image, this one is on a base64 format so first we decode it
$image = base64_decode($request->thumbnail);
//and then store it to the same location of the first image with its new name and extension same to the first image
$image->move(base_path().'/public/images/uploads/', $fileName.'_thumbnail.'.$extension);
Please read the comment line per code line from the codes above, anyway, it throws me an error
Call to a member function move() on a non-object and its pointing in this line
$image->move(base_path().'/public/images/uploads/', $fileName.'_thumbnail.'.$extension);
any help, clues, ideas, suggestions, recommendations?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire