Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
648 views
in Technique[技术] by (71.8m points)

amazon s3 - AWS SDK PHP version 2 - retrieving image dimensions?

Is it possible to retrieve the dimensions of an image stored on Amazon S3?

If the answer is no, are there any other ways around it other than downloading the image to my server to which sounds inefficient?

I'm using version 2 of the AWS SDK for PHP.

I've been looking through what is returned from the following code but doesn't seem to give dimensions.

$result = $s3->getObject(array(
    'Bucket' => 'BUCKET_NAME',
    'Key'    => 'KEY_NAME'
));

var_dump($result);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm not 100% familiar with SDK2. With 1.5 you could do this

getimagesize($s3->get_object_url($bucket,$filename)); 

I think this is still possible as long as you can access publicly the image (or you have to find your way around authorized urls)

Obviously, your php must be enabled to open remote files.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...