脚本宝典收集整理的这篇文章主要介绍了为什么我用php旋转后无法使png的背景透明?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我目前的代码..
function rotate($degrees) { $image = $this->image; imagealphablending($image,false); $color = imagecolorallocatealpha($image,127); $rotate = imagerotate($image,$degrees,$color); imagecolortransparent($rotate,$color); imagesavealpha($image,true); $this->image = $rotate; }
我的WamP服务器和Dreamweaver可能有问题吗?因为我甚至尝试了这个.. http://www.exorithm.com/algorithm/view/rotate_image_alpha,它仍然是黑色或白色背景..
目前,您在原始图像上运行imagesavealpha(). [例如imagesavealpha($image,true); ]
相反,你想在旋转的图像上运行imagesavealpha(),然后设置$this-> image … try:
... $rotate = imagerotate($image,$color); imagecolortransparent($rotate,$color); imagesavealpha($rotate,true); // <- using $rotate instead of $image $this->image = $rotate;
}
以上是脚本宝典为你收集整理的为什么我用php旋转后无法使png的背景透明?全部内容,希望文章能够帮你解决为什么我用php旋转后无法使png的背景透明?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。