I'm attempting to set the background color of an image, but it doesn't seem to be working. The PNG image has a transparent background to begin with, but whenever I print the image out, the background is always white.
This is the code I'm using:
$clan_cin = "X38-TEK9";
$cnopseal_image = ImageCreateFromPNG("http://www.centraloutpost.com/cnopapproved.png");
$background_color = ImageColorAllocate($cnopseal_image, 0, 0, 0);
$font_color = ImageColorAllocate($cnopseal_image, 255, 242, 0);
$text = $clan_cin;
$font = "silkscreen.ttf";
$size = 6.5;
$xi = ImageSX($cnopseal_image);
$box = ImageTTFBBox($size, 0, $font, $text);
$xr = abs(max($box[2], $box[4]));
$x = intval(($xi - $xr) / 2);
$y = 28;
ImageTTFText($cnopseal_image, $size, 0, $x, $y, $font_color, $font, $text);
header('Content-type: image/png');
ImagePNG($cnopseal_image);
You can see what it produces:
http://www.centraloutpost.com/cnopsys/cnop_sealgen.php
Anyone have any idea why it's not working for me?