How do I make the text transparent over the background ?

In my web app, I want to to put a layer BEHIND the image to control the color of the php-created text
So, the layer color in the web app shows thru the text php creates....
Would like to use  alpha transparency so the color looks clean :)

how would I amend the below script to do this ?

many thanks
g

header("Content-type:".$mime); //$mime = image/png
$im = imagecreatetruecolor(200, 16);  //use to draw a text box

imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
$left    = 5; //add a little pad to the left edge
$color = imagecolorallocate($im, 255, 255, 255);
$fontSize = 11;

// choose a font
$fontPath = "/home/siren/fonts/";
$defaultFont = "tahomabd.ttf";
$fontName = "arial.ttf";
$font = $fontPath.$fontName ;
if (! file_exists($font)) {
   $font = $fontPath.$defaultFont ;
}

$text= "background color shows through the text" // Add the text
imagettftext($im, $fontSize, 0, 10, 13, $color, $font, $text);
imagepng($im);
readfile($im);
imagedestroy($im);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to