使用旋轉圖像,下面的代碼與透明背景調整和調整大小相同,如何旋轉圖像,並使用PHP GD
<?php
$src = "41611326.png";
// Get new dimensions
list($width, $height) = getimagesize($src);
$new_width = 192;
$new_height = 192;
$dstimage=imagecreatetruecolor($new_width,$new_height);
$srcimage = imagecreatefrompng($src);
$degrees = -30;
$srcimage = imagerotate($srcimage, $degrees, 0) ;
imagealphablending($dstimage, false);
imagesavealpha($dstimage, true);
imagecopyresampled($dstimage,$srcimage,0,0,0,0, $new_width,$new_height,$width,$height);
header('Content-type: image/png') ;
imagepng($dstimage) ;
?>
但其輸出圖像沒有得到透明背景。如何保持透明背景。
請任何幫助