Re: Making Text [not the background] transparent
| From: | Joe Wollard | Date: | Fri, 02 Sep 2005 16:35:38 +0000 |
| Subject: | Re: Making Text [not the background] transparent | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221761@lists.php.net to get a copy of this message | ||
Graham:
Unless you need a specific font you could just do this by using pure CSS. If you do, the image layer would be behind the text layer. The text layer can be set to any color and (in most every modern browser) any alpha level.
<div style="filter: alpha(opacity=90); opacity:0.9; background-color:transparent; color:#000;">This is some translucent text</div>
good luck!
-Joe
On Aug 31, 2005, at 1:09 PM, Graham Anderson wrote:
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