how to get private images in s3 laravel

Solutions on MaxInterview for how to get private images in s3 laravel by the best coders in the world

showing results for - "how to get private images in s3 laravel"
Federica
19 Apr 2019
1use Storage;
2use Config;
3
4$client = Storage::disk('s3')->getDriver()->getAdapter()->getClient();
5$bucket = Config::get('filesystems.disks.s3.bucket');
6
7$command = $client->getCommand('GetObject', [
8    'Bucket' => $bucket,
9    'Key' => '344772707_360.mp4'  // file name in s3 bucket which you want to access
10]);
11
12$request = $client->createPresignedRequest($command, '+20 minutes');
13
14// Get the actual presigned-url
15echo $presignedUrl = (string)$request->getUri();