【发布时间】:2012-08-18 10:16:55
【问题描述】:
我一直在抨击一些简单的事情..
// ....all prev code is fine....
$pasteboard =imagecreatetruecolor($imgs['bg']["width"],$imgs['bg']["height"]);
imagealphablending($pasteboard, false);
imagecopyresampled($pasteboard, $imgs['bg']["img"],0,0,0,0,$imgs['bg']["width"],$imgs['bg']["width"],imagesx($imgs['bg']["img"]),imagesy($imgs['bg']["img"]));
imagecopyresampled($pasteboard, $imgs['photo']["img"],20,20,0,0,$imgs['photo']["width"],$imgs['photo']["width"],imagesx($imgs['photo']["img"]),imagesy($imgs['photo']["img"]));
imagesavealpha($pasteboard,true);
//send it out
$out = $pasteboard;
header('Content-type: image/png');
imagepng($out);
//then garbage collection
给我这个:
万岁!
完美的 alpha png 合成...
现在我想旋转它,所以我这样做而不是 $out=$pasteboard:
imagesavealpha($pasteboard,true);
//rotate it
$out = imagerotate($pasteboard,5,imagecolorexactalpha($pasteboard,255,255,255,50),0);
header('Content-type: image/png');
imagepng($out);
这很遗憾地给了我这个:
嘘!
我试过设置颜色:
imagerotate($pasteboard,5,0x00000000,0);
还有最后一个属性,比如:
imagerotate($pasteboard,5,0x00000000,1);
新的空图像采样等...
没有骰子....
谁能帮忙?
【问题讨论】:
-
在致电
imagesavealpha之前尝试旋转它 -
感谢@Musa 也尝试过......!
-
ignore_transparent(第 4 个参数)仅在 PHP 5.1 中添加。通过
echo phpversion();检查您使用的 PHP 版本 -
感谢@xconspirisist 很遗憾我已经看到那一点了.. 5.3 版