cakephp + aws getobjecturl

Я работаю над проектом, который использует cakephp V2.3 с AWS PHP SDK V2.8. Он размещен на машине AWS EC2 Ubuntu. Я пытаюсь получить изображение, размещенное на AWS S3, с помощью следующего кода

try {
$resultS3 = $this->Amazon->S3->getObject(array(
'Bucket' => 'mytest.sample',
'Key' => 'files/user/image/35/1440319731.png',
));
} catch (S3Exception $e) {
pr($e); //die;
}

и ответ следующий

     Guzzle\Service\Resource\Model Object
(
[structure:protected] =>
[data:protected] => Array
(
[Body] => Guzzle\Http\EntityBody Object
(
[contentEncoding:protected] =>
[rewindFunction:protected] =>
[stream:protected] => Resource id #135
[size:protected] =>
[cache:protected] => Array
(
[wrapper_type] => PHP
[stream_type] => TEMP
[mode] => w+b
[unread_bytes] => 0
[seekable] => 1
[uri] => php://temp
[is_local] => 1
[is_readable] => 1
[is_writable] => 1
)

[customData:protected] => Array
(
[default] => 1
)

)

[DeleteMarker] =>
[AcceptRanges] => bytes
[Expiration] =>
[Restore] =>
[LastModified] => Wed, 21 Oct 2015 12:24:59 GMT
[ContentLength] => 84890
[ETag] => "7ec848d6e0cd988bf4f3702315a0102b"[MissingMeta] =>
[VersionId] =>
[CacheControl] =>
[ContentDisposition] =>
[ContentEncoding] =>
[ContentLanguage] =>
[ContentRange] =>
[ContentType] => binary/octet-stream
[Expires] =>
[WebsiteRedirectLocation] =>
[ServerSideEncryption] => AES256
[SSECustomerAlgorithm] =>
[SSECustomerKeyMD5] =>
[SSEKMSKeyId] =>
[StorageClass] =>
[RequestCharged] =>
[ReplicationStatus] =>
[RequestId] => 378C9733A89539A9
)

)

Я могу показать изображение по следующему коду

header("Content-Type: {$resultS3['ContentType']}");
echo $resultS3['Body'];

но я хочу URL, чтобы я мог отображать несколько изображений, выбирая из S3.

Я старался getObjectUrl тоже

$result = $this->Amazon->S3->getObjectUrl('bucket name','files/user/image/35/1440319731.png');

это дает мне URL изображения, но из-за server side encryption (AES256) (который я использую в putObjectЯ не могу этого показать.

Я пытался передать тип шифрования в аргументе, но безуспешно.

$result = $this->Amazon->S3->getObjectUrl('bucket name','files/user/image/35/1440319731.png', $expires = null, $args = array('ServerSideEncryption' => 'AES256'));

Есть ли способ получить объект по URL, когда шифрование на стороне сервера есть?

0

Решение

Попробуй это…

public function read($location){
return $this->s3->get_object_url($this->bucket, $location, strtotime('+1 minute'), array('https' => true));
}
0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector