On Sunday 15 December 2002 06:31, Ryan Smaglik wrote:

First, please use a _descriptive_ subject. Something which gives people an 
idea of what your post is about.

> I got a generic ≥text to png on the fly≤ script which works fine but I want
> to change it so that the image only the size of the text. (so the text has
> no border, or padding around it) For and example of what I want to do check
> out: http://www.spoono.com/font/?string=This is what i want to do&.png
> I have the script:
> <?
>
>   Header("Content-type: image/png");
>
>   if(!isset($s)){$s=8;}
>
>   $size =
> imagettfbbox($s,0,"/home/xelerix/public_html/font/fonts/04B_03__.TTF",$text
>) ;
>
>   $dx = abs($size[2]-$size[0]);
>
>   $dy = abs($size[5]-$size[3]);
>
>   $xpad=9;
>
>   $ypad=9;

By their very name, I would guess these two values are used as padding to give 
a border around the text. Try removing them.

>   $im = imagecreate($dx+$xpad,$dy+$ypad);
>
>   $bg = ImageColorAllocate($im, 102,102,102);
>
>   $white = ImageColorAllocate($im, 255,255,255);
>
>   ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2), $white,
> "/home/xelerix/public_html/font/fonts/04B_03__.TTF", $text);
>
>   imagepng($im);
>
>   ImageDestroy($im);
>
> ?>


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"This isn't brain surgery; it's just television."
- David Letterman
*/


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

Reply via email to