我有我的照片在Amazon S3。这些照片是专用的,不公开的,所以我不能直接链接向他们展示 s3.amazonaws / bucket_name / KEY_NAME / image_name.jpg
我知道在Amazon S3上的图像名称。如何显示例如Amazon S3的图像flower.png和house.png在我的网站使用PHP?
解决方案如果你不想让你的文件中公开,这里是过程。
确保您的S3存储是私有的。只有经过验证和授权的呼叫被允许让你的对象
在服务器端,呈现页面时,生成链接到S3对象,包括一个签字。签名将从您的访问和密钥进行计算,并会告诉S3呼叫必须被授权
S3签名的网址很容易产生从我们的SDK。对于PHP,只是检查了文档的http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-s3.html#creating-a-$p$p-signed-url
在网页中,当用户将点击一个标识的URL,浏览器将被引导至S3。 S3将验证签名, - 当正确的 - 将获取对象I have my pictures on Amazon S3. The pictures are private and not public so I can not show them with a direct link s3.amazonaws/bucket_name/key_name/image_name.jpg
![亚马逊s3的使用方法 使用Amazon S3 –第一部分](https://p.xsw88.cn/allimgs/daicuo/20230911/3670.png)
I know the image names on Amazon S3. How do I show for example the Amazon S3 images flower.png and house.png on my website with PHP?
解决方案If you don't want to make your file public, here is the procedure.
ensure your S3 bucket is private. Only authenticated and authorised calls are allowed to get your objects
on the server side, when rendering the page, generate links to S3 object that include a signature. The signature will be computed from your access and secret key and will tell S3 that the call must be authorised
S3 Signed URL are easy to generate from our SDK. For PHP, just check the doc at http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-s3.html#creating-a-pre-signed-url
in the web page, when the user will click a signed URL, the browser will be directed to S3. S3 will verify the signature and - when correct - will get the object相关推荐
最新文章