二個重點函數
imagealphablending($thumb,false)
imagesavealpha($thumb,true);
[php]
function pngthumb($sourePic,$smallFileName,$width,$heigh){
$image=imagecreatefrompng($sourePic);//PNG
imagesavealpha($image,true);
$BigWidth=imagesx($image);
$BigHeigh=imagesy($image);
$thumb = imagecreatetruecolor($width,$heigh);
imagealphablending($thumb,false);
imagesavealpha($thumb,true);
if(imagecopyresampled($thumb,$image,0,0,0,0,$width,$heigh,$BigWidth,$BigHeigh)){
imagepng($thumb,$smallFileName);}
return $smallFileName;
}
[/php]