Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
653 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...