here the working version of walf's solution
<?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;
}
}
?>