show png transparent
Posted: Sun Jul 06, 2003 6:36 am
hi i have a problem
i have a source picture and i write text on it and then i will show this new picture with a transparent background (backgroundcolor=black)
but it wont work
here is my code
but my background is still black instead of transparent
does anyone know why ?
please help
i have a source picture and i write text on it and then i will show this new picture with a transparent background (backgroundcolor=black)
but it wont work
here is my code
Code: Select all
<?PHP
Header("Content-type: image/png");
$width = 40;
$height = 40;
$color = '000000';
$font = 'FF0000';
function ImageHexColorAllocate(&$image,$hexstr) {
return ImageColorAllocate($image,hexdec($hexstrї0].$hexstrї1]),hexdec($hexstrї2].$hexstrї3]),hexdec($hexstrї4].$hexstrї5]));
}
$image = ImageCreate($width,$height);
$org = ImageCreateFromPNG( "picture.png" );
ImageCopy($image,$org,0,0,0,0,40,40);
ImageString($image,2,7,14,'text',ImageHexColorAllocate($image,$font ));
$trans = ImageColorTransparent($image,ImageHexColorAllocate($image,$color));
ImagePNG($image);
imagedestroy($image);
imagedestroy($org);
?>does anyone know why ?
please help