I have a strange situation.
it looks like background not always transparent, but on some degree it broken...
here is the code:
$angle = !empty($_GET['a']) ? (int)$_GET['a'] : 0;
$im = imagecreatefromgif(__DIR__ . '/track/direction1.gif');
imagealphablending($im, false);
imagesavealpha($im, true);
$transparency = imagecolorallocatealpha($im, 0, 0, 0, 127);
$rotated = imagerotate($im, $angle, $transparency);
imagealphablending($rotated, false);
imagesavealpha($rotated, true);
imagepng($rotated);
imagedestroy($rotated);
imagedestroy($im);
header('Content-Type: image/png');
just can`t understand what is going on... am i missed somth?
EDIT1
added that func:
if(!function_exists('imagepalettetotruecolor'))
{
function imagepalettetotruecolor(&$src)
{
if(imageistruecolor($src))
{
return true;
}
$dst = imagecreatetruecolor(imagesx($src), imagesy($src));
$black = imagecolorallocate($dst, 0, 0, 0);
imagecolortransparent($dst, $black);
$black = imagecolorallocate($src, 0, 0, 0);
imagecolortransparent($src, $black);
imagecopy($dst, $src, 0, 0, 0, 0, imagesx($src), imagesy($src));
imagedestroy($src);
$src = $dst;
return true;
}
}
but now stuck withthat square do not want to be transparent....