Category : base64

$file = $request->file(‘photo’); if (!empty($file)) { $fileName = $file->getClientOriginalName(); $folder = uniqid() . ‘-‘ . now()->timestamp; $filePath = Storage::disk(‘fileUploadToPublic’)->putFileAs("contentFiles/{$folder}", $file, $fileName); $dataToInsert[‘photo’] = $filePath; } I used to store the uploaded image inside the public folder before with the above code , so i could view the image with its filepath. But now, i would ..

Read more

How to store base64 image in other storage location. By default image store in storage/app folder. For example:- $request->base64_image //base64 encoded $data = substr($request->base64_image, strpos($request->base64_image, ‘,’) + 1); $data = base64_decode($data); Storage::disk(‘local’)->put("test.png", $data); But I have save image on other location. $request->base64_image //base64 encoded $data = substr($request->base64_image, strpos($request->base64_image, ‘,’) + 1); $data = base64_decode($data); Storage::disk(‘newfolder’)->put("test.png", ..

Read more

I am trying to save base64 as an image in laravel and uplod it to s3 bucket. $selfie_photo = str_replace(‘data:image/png;base64,’, ”, $request->selfie_photo); Storage::disk(‘s3’)->put(‘collection_photo/’.$request->case_id.’.jpeg’, base64_decode($selfie_photo),’public’); $other_photo = str_replace(‘data:image/png;base64,’, ”, $request->other_photo); Storage::disk(‘s3’)->put(‘collection_photo/’.$request->case_id.’.jpeg’, base64_decode($other_photo),’public’); It’s making a file in s3 bucket but when i open the image it’s saying don’t support this file format Sourc..

Read more

i’m triyng to get original File object back from base64 content. the method i’m using is private function _base64ToImage($base64_string, $locationId) { $output_file = storage_path() . "/app/public/uploads/locations/my.jpg"; $file = fopen($output_file, "wb"); $data = explode(‘,’, $base64_string); fwrite($file, base64_decode($data[1])); fclose($file); return $output_file; } i know this is not the way. i don’t want to fopen or fwrite anything. ..

Read more

i’m trying to get files from storage folder and converting them into base64 in vue.js. i’m using below method, But it seems not working. public function getImages() { $filesToReturn = []; $files = File::files(storage_path() . "/app/record_keeper"); foreach ($files as $file) { array_push($filesToReturn, $file->getRealPath()); } return response->json([‘files’ => $filesToReturn], $this->response_status_code, 200); } returned file urls {"files":["/home/Project/vue_image_previewer/storage/app/record_keeper/1.jpeg","/home/Project/vue_image_previewer/storage/app/record_keeper/2.jpeg"} ..

Read more

i am sending an image to laravel api using retrofit D/NetworkManagementSocketTagger: tagSocket(74) with statsTag=0xffffffff, statsUid=-1 I/mple1.messegin: Background concurrent copying GC freed 21904(27MB) AllocSpace objects, 14(3MB) LOS objects, 50% free, 18MB/37MB, paused 402us total 102.147ms E/FF1: 500 Response{protocol=http/1.1, code=500, message=Internal Server Error, url=http://192.168.1.8/company_messenger/public/apistore} i see the first line then after a moment the other tow lines ..

Read more