这是 walf 的解决方案的工作版本
<?php
if (!function_exists('imagepalettetotruecolor')) {
function imagepalettetotruecolor(&$src) {
if (imageistruecolor($src)) {
return true;
}
$dst = imagecreatetruecolor(imagesx($src), imagesy($src));
imagealphablending($dst, false);$transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127);imagefilledrectangle($dst, 0, 0, imagesx($src), imagesy($src), $transparent);imagealphablending($dst, true);imagecopy($dst, $src, 0, 0, 0, 0, imagesx($src), imagesy($src));
imagedestroy($src);
$src = $dst;
return true;
}
}
?>