- Chung
- 0°C
- 10 年又 71 天
解決png圖檔GD合圖後背景色塊問題
重點在於設定圖片走透明通道~$img = imagecreatefrompng($src);
imagesavealpha($img,true);
$thumb = imagecreatetruecolor(300,300);
imagealphablending($thumb,false);//這裡很重要,意思是不合併顏色,直接用$img圖像顏色替換,包括透明色;
imagesavealpha($thumb,true); //這裡很重要,意思是不要丟了NewCanves圖像的透明色;
imagecopyresampled($thumb,$img,0,0,0,0,300,300,300,300);
imagepng($thumb,"temp.png"); 台北市內湖區江南街71巷75弄 Go
- 1,861
- 0
- 0

