0
我已经浏览了很多其他线程与人们遇到麻烦与一个PNG图像变黑,它应该是透明的,没有解决方案为我工作。透明PNG黑色
也许我会错在其他地方在代码?也许我的web服务器不支持imagealhpablending?
感谢任何人都可以提供帮助。
$photo = imagecreatefrompng("{$thumb_folder}{$new_file_name}");
$width = imagesx($photo);
$height = imagesy($photo);
$new_width = 32;
$new_height = floor($height/($width/$new_width));
$temp_photo = imagecreatetruecolor($new_width, $new_height);
imagealphablending($temp_photo, false);
imagesavealpha($temp_photo, true);
$transparent = imagecolorallocatealpha($temp_photo, 255, 255, 255, 127);
imagefilledrectangle($temp_photo, 0, 0, $new_width, $new_height, $transparent);
imagecopyresampled($temp_photo, $photo, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagepng($temp_photo, "{$thumb_folder}{$new_file_name}");