Bug #18062 Updated: Generating true type font images not working
| From: | derick@php.net | Date: | Wed, 03 Jul 2002 12:29:46 +0000 |
| Subject: | Bug #18062 Updated: Generating true type font images not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-12974@lists.php.net to get a copy of this message | ||
ID: 18062
Updated by: derick@php.net
Reported By: usenet@watson-wilson.ca
-Status: Open
+Status: Feedback
Bug Type: GD related
Operating System: Linux 2.4.18
PHP Version: 4.2.1
New Comment:
Can you provide the font then?
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-07-03 08:25:55] usenet@watson-wilson.ca
The very nature of this problem is generating an image using an
externally referenced true type font. There is no way that I know of
to include the font in the php script.
------------------------------------------------------------------------
[2002-07-02 21:43:18] sniper@php.net
Provide a complete, self-contained script. The one here now can't be
copy'pasted and run..
------------------------------------------------------------------------
[2002-06-30 11:07:36] usenet@watson-wilson.ca
1. I have not updated or changed GD in anyway.
2. I've tried --with-ttf=/usr/local but there was no improvement.
Here is the script:
<?
Header("Content-type: image/png");
// note - must use the absolute font path
// be careful about blank lines in your code which will output a blank
and confuse browser
$font = "/usr/X11R6/lib/X11/fonts/drakfont/WORLDOFW.ttf";
$box = imagettfbbox($size, 0, $font, $text);
$xsize = $box[2]-$box[0]+10;
$ysize = $box[1]-$box[7]+10;
$xstart = ($xsize - ($box[2] - $box[0])) / 2;
$ystart = ($ysize - ($box[1] - $box[7])) / 2 - $box[7];
$im = imagecreate($xsize,$ysize);
$white = ImageColorAllocate($im, 255,255,255);
$black = ImageColorAllocate($im, 0,0,0);
$trans=ImageColorTransparent($im,$white);
ImageTTFText($im, $size, 0, $xstart, $ystart, $black, $font, $text);
Imagepng($im);
ImageDestroy($im);
?>
------------------------------------------------------------------------
[2002-06-29 12:22:40] sniper@php.net
And this is wrong:
--with-ttf=/usr/local/lib
It should be:
--with-ttf=/usr/local
------------------------------------------------------------------------
[2002-06-29 12:18:46] sniper@php.net
Did you happen to update GD library?
And we really need a short example script too..
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/18062
--
Edit this bug report at http://bugs.php.net/?id=18062&edit=1