Page 1 of 1

imagecolortransparent not making it transparent

Posted: Sat Apr 29, 2006 7:29 am
by anjanesh
Any idea why the transparency doesnt work ?

Code: Select all

<?php
$Font_File = "times.ttf";
$Size = 12;
$Text = "Test Text";

$Text_Coords = imagettfbbox($Size, 0, $Font_File, $Text);

$lx = abs($Text_Coords[2] - $Text_Coords[0]) + 10;
$ly = abs($Text_Coords[5] - $Text_Coords[3]) + 10;

$Image = imagecreatetruecolor($lx, $ly);

$white = imagecolorallocate($Image, 255, 255, 255);
$black = imagecolorallocate($Image, 0, 0, 0);

imagefilledrectangle($Image, 0, 0, $lx, $ly, $white);
imagecolortransparent($Image, $white);

imagettftext($Image, $Size, 0, 3, abs($Text_Coords[5] - $Text_Coords[3]) + 3, $black, $Font_File, $Text);
imagegif($Image, "test.gif");
imagedestroy($Image);
?>
Thanks