Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to get private images in s3 laravel

use Storage;
use Config;

$client = Storage::disk('s3')->getDriver()->getAdapter()->getClient();
$bucket = Config::get('filesystems.disks.s3.bucket');

$command = $client->getCommand('GetObject', [
    'Bucket' => $bucket,
    'Key' => '344772707_360.mp4'  // file name in s3 bucket which you want to access
]);

$request = $client->createPresignedRequest($command, '+20 minutes');

// Get the actual presigned-url
echo $presignedUrl = (string)$request->getUri();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #private #images #laravel
ADD COMMENT
Topic
Name
7+8 =