Re: ImageTTFText leaves Black in letters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks for the response. Here's the relevant bit:
  $fontcolour = imagecolorallocatefromhex($i,$tcolor);
  $font2colour = imagecolorallocatefromhex($i, $t2color);
  $bg = imagecolorallocatefromhex($i,$bcolor);

  if($bcolor == '#000000') $bg = imagecolorallocate($i, 0, 0, 0);
  if($tcolor == '#000000') $fontcolour = imagecolorallocate($i, 1, 0, 0);
  if($t2color== '#000000') $font2colour = imagecolorallocate($i, 1, 0, 0);

if($_GET['fontFileName'] == "") {$fontfile = "arial.ttf";} else {$fontfile =
$_GET['fontFileName'];}
//echo "fonts/$fontfile";
$box = imagettfbbox(40, 0, "fonts/".$fontfile, $_GET['text']);
$ax = ceil((500 - $box[2]) / 2);
$ay = ceil((170 - $box[3]) / 2);
$box2 = imagettfbbox(20, 0, "fonts/arial.ttf", $_GET['text2']);
$bx = ceil((500 - $box2[2]) / 2);
$by = ceil((170 - $box2[3]) / 2) + 50;
//image, size, angle, x, y, color, font, text
imagettftext($i, 40, 0, $ax, $ay, $fontcolour, "fonts/".$fontfile,
$_GET['text']);
imagettftext($i, 20, 0, $bx, $by, $font2colour, "fonts/arial.ttf",
$_GET['text2']);
imagefill($i, 0, 0, $bg);
imagepng($i);

Thanks,
Stephen

On Tue, Jun 24, 2008 at 5:32 PM, Boyd, Todd M. <tmboyd1@xxxxxxxx> wrote:

> > -----Original Message-----
> > From: Stephen Pynenburg [mailto:spynenburg@xxxxxxxxx]
> > Sent: Tuesday, June 24, 2008 4:27 PM
> > To: php-general@xxxxxxxxxxxxx
> > Subject:  ImageTTFText leaves Black in letters
> >
> > Hi all,
> > I'm using imagettftext, and my script works perfectly, except that on
> > these
> > TTF fonts that I'm using, in any letter with a hole in the middle
> > (letters
> > like a, R, O) the hole is coloured black, not transparent. Is this a
> > PHP
> > thing, or do I need to edit my fonts somehow?
>
> Stephen,
>
> Please include the source in question--most specifically, the section
> where ImageTTFText is invoked.
>
>
> Todd Boyd
> Web Programmer
>
>
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux