簡體   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