繁体   English   中英

使用 PHP 旋转图像时出现黑色背景

[英]Black background when rotating image with PHP

我正在尝试使用 PHP 旋转 PNG 图像。 图像旋转但出现黑色背景。

这是我的代码:

$image = $_GET['image'];
$degrees = $_GET['degrees'];

header('Content-type: image/png');
$source = imagecreatefrompng($image) ;
$rotate = imagerotate($source, $degrees, 0);
imagesavealpha($rotate, TRUE);
imagepng($rotate);

return rotate;

还添加该行

imagealphablending($rotate, true);

imagesavealpha($rotate, TRUE);

来源: PHP imagerotate 中的评论

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM