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

Categories

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

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

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...