You are here: Re: [PHP] Making Text [not the background] transparent « PHP « IT news, forums, messages
Re: [PHP] Making Text [not the background] transparent

Posted by Joe Wollard on 09/02/05 19:35

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
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация