Php Amazon S3 png文件不';我没有透明度
我不确定我做错了什么,但是上传到S3 Amazon bucket的PNG文件显示为白色而不是透明,即使本地文件显示为透明。以下是我所拥有的:Php Amazon S3 png文件不';我没有透明度,php,zend-framework,amazon-s3,gd,Php,Zend Framework,Amazon S3,Gd,我不确定我做错了什么,但是上传到S3 Amazon bucket的PNG文件显示为白色而不是透明,即使本地文件显示为透明。以下是我所拥有的: $thumb = \PhpThumbFactory::create( $content, array( 'jpegQuality' => 100 ), true ); $thumb->setFormat('PNG'); ob_start(); $thumb->show(true); $content = ob_
$thumb = \PhpThumbFactory::create(
$content,
array(
'jpegQuality' => 100
),
true
);
$thumb->setFormat('PNG');
ob_start();
$thumb->show(true);
$content = ob_get_clean();
//This part is for testing purposes, I store the file locally to see that the transparency is there
$file = 'picture' . '-' . time() . '.png';
file_put_contents($file, $content); //The file created is an image which perfectly shows the transparent, as it should be
//The code below should upload the same file, but somehow it replaces transparency with a white color.
$S3 = new Zend_Service_Amazon_S3($myKey, $mySecret);
$response = $S3->putObject(
$bucket,
$content,
array(
Zend_Service_Amazon_S3::S3_CONTENT_TYPE_HEADER => 'image/png',
Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ
)
);
我上传时是否遗漏了什么?有什么我应该在bucket上配置的吗?看起来像是你先创建了一个jpg的缩略图,所以它去掉了透明度,amazon S3没有什么问题,就像我说的,我正在本地保存文件,本地文件有透明度。我保证这不是amazon的问题,他们不会改变你上传的文件,这是你的代码;-)我们也遇到了类似的问题,定义内容长度明确地解决了这个问题。再看看:他们也有类似的问题。虽然没有深入研究,但似乎有一种方法可以迫使S3保持透明。