AWS开发工具包PHP PHP版本2-检索图像尺寸? [英] AWS SDK PHP version 2 - retrieving image dimensions?

查看:67
本文介绍了AWS开发工具包PHP PHP版本2-检索图像尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检索存储在Amazon S3上的图像的尺寸?

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?

我正在使用适用于PHP的AWS开发工具包的版本2.

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);

推荐答案

由于缺乏响应,我认为这是不可能的.

Due to lack of response I'll presume it's not possible... Didn't r3ally want to do it with JavaScript but this is how I did it.

<img src="image.jpg" id="image" />

<script>
// This runs after the image has loaded
$('#image').load(function() {
    // Use the below code to get the height and width
    // document.getElementById('image').width
    // document.getElementById('image').height
});
</script>

这篇关于AWS开发工具包PHP PHP版本2-检索图像尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆