You won't get a cloudfront URL from S3, it's a different service. If your using putObject
then you already know the file path (value specified in Key
).
Just return the cloudfront URL in front of the file path e.g...
$filePath = '/path/file.jpg';
$client->putObject(array(
'Bucket' => 'mybucket',
'Key' => $filePath,
'SourceFile' => $fileSource,
'ACL' => 'public-read'
));
return 'https://d111111111ck.cloudfront.net' . $filePath;