PJ wrote:
Is there a module to be activated or what has to be installed to have
ttf support in php?
My port on FreeBSD does not have an option for ttf support under make
config .
I'm trying to learn & understand the following:
In file1 : <img src="button.php?s=36&text=PHP+is+Cool" />
In file2 (button.php)- originally php3 :
  Header("Content-type: image/gif");
  if(!isset($s)) $s=11;

The above should be:

if ( empty($_GET['s']) ) {
        $s = 11;
} else {
        $s = (int)$_GET['s'];

  $size = imagettfbbox($s,0,"times.ttf",$text);

and this should be

$text = '';
if ( !empty($_GET['text']) )
        $text = your_custom_input_cleaner_function($_GET['text']);

$size = imagettfbbox($s,0,"times.ttf",$text);

  $dx = abs($size[2]-$size[0]);
  $dy = abs($size[5]-$size[3]);
  $im = imagecreate($dx+$xpad,$dy+$ypad);
  $blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
  $black = ImageColorAllocate($im, 0,0,0);
  $white = ImageColorAllocate($im, 255,255,255);
  ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black,
"times.ttf", $text);
  ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white,
"times.ttf", $text);
ONLY the above & nothing else. So far, all I get is a small blue square.
Replacing the $text with the text just gives a rectangle a bit wider.
gd is installed but ttf is not, so I figure that is the culprit.
But how is the text supposed to be assigned to $text from file1?

Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

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

Reply via email to