Make PNG background transparent. It's black by default

This commit is contained in:
Aleksei Savin
2023-11-20 18:18:56 +09:00
committed by Michael Larabel
parent 811a53bc3b
commit b0046d9414

View File

@@ -140,6 +140,11 @@ class pts_svg_dom_gd
if(extension_loaded('gd') && function_exists('imagettftext') && $width > 1 && $height > 1)
{
$gd = imagecreatetruecolor($width, $height);
# Make the background transparent; otherwise it's black
imagesavealpha($gd, true);
$alp_clr = imagecolorallocatealpha($gd, 0, 0, 0, 127);
imagefill($gd, 0, 0, $alp_clr);
if(function_exists('imageresolution'))
{
imageresolution($gd, 200);