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
Post a Comment