具体方法:在open方法的最后面加上
if ('png' == $this->info['type']){
imagesavealpha($this->img, true);
}
当然还有另外一种方法可以在crop方法中添加 imagefill的方式实现缩略图的透明处理(确定是图片较小不需要压缩的情况下 不走crop方法)
具体实现:在crop方法内
$color = imagecolorallocate($img, 255, 255, 255);
imagecolortransparent($img,$color);
imagefill($img, 0, 0, $color);//需要添加的代码
最佳答案
