luq*_*ita 5 php gd zend-framework amazon-s3
我不确定我做错了什么,但上传到 S3 Amazon 存储桶的 PNG 文件显示白色而不是透明,即使本地文件确实显示透明。这是我所拥有的:
$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
)
);
Run Code Online (Sandbox Code Playgroud)
上传时我遗漏了什么吗?我应该在存储桶上配置什么吗?
| 归档时间: |
|
| 查看次数: |
1203 次 |
| 最近记录: |