Move images from one server to s3 PHP Laravel 5.3 -


i'm trying write script i'm trying move images old server amazon s3. possible downloading image url?

$companies = company::all();  $companies->each( function ($company) {      //some method download file     $file = download($company->logo);      //store on s3     $filename = $file->storeas('images', uniqid('img_') . "." . $file->guessclientextension(),'s3');      //get new path     $new_path = storage::disk('s3')->url($filename);      //save new path logo     $company->logo = $new_path;      //save new path     $company->save(); } 

you can use library php league filesystem

it has integration laravel , other framewoks such zend, cake etc

the library has adapter amazon s3 v2 , amazon s3 v3

full documentation here


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -