PHP Imagick:直接写入图像到Amazon S3? [英] PHP Imagick: Write Image directly to Amazon S3?

查看:125
本文介绍了PHP Imagick:直接写入图像到Amazon S3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能对我来说,使用Imagick的writeImage函数写的图像直接到S3存储?如果是这样,怎么样?我是pretty的新的Amazon S3的SDK,所以一些帮助将AP preciated。

Is it possible for me to use the writeImage function in Imagick to write an image directly to an S3 bucket? If so, how? I'm pretty new to the Amazon S3 SDK, so some help would be appreciated.

推荐答案

通过writeImage,可能不是(它需要一个文件路径作为参数,从而写入文件到文件系统),但是你可以 getImageBlob 来获得图像,你可以轻松地编写到S3与特定名称的二进制字符串。这将是您最易于使用S3 PHP库,有一个在AWS PHP SDK一名官员,或者有第三方库,以及,像这样的:

With writeImage, probably not (it takes a file path as argument, thus writing the file to the filesystem), but you can getImageBlob to get the image as binary string which you can then easily write to S3 with certain name. It would be easiest for you to use an S3 PHP library, there is one official in the AWS PHP SDK, or there are 3rd party libraries as well, such as this one:

https://github.com/mackstann/amazon-s3-php-class
// Put an object from a string:
$s3->putObject($string, $bucketName, $uploadName, S3::ACL_PUBLIC_READ)

这篇关于PHP Imagick:直接写入图像到Amazon S3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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