Last updated on February 17, 2018
I will show you, how is easy it is to convert base64 format image to image. All you have to extract the base64 image data from that string, decode it and then you can save it to disk.
Here is the function, which will save a base64 image to disk.
public function createImageFromBase64(Request $request){ $file_data = $request->input('company_logo'); $file_name = 'image_'.time().'.png'; //generating unique file name; @list($type, $file_data) = explode(';', $file_data); @list(, $file_data) = explode(',', $file_data); if($file_data!=""){ // storing image in storage/app/public Folder \Storage::disk('public')->put($file_name,base64_decode($file_data)); } }