ImageFtBbox() can do this for you.

Here's a portion of my code that uses it. >>

$string="This is some text";
$pointsize = 15;
$fontfile = getcwd()."/arial.ttf";
$string_size = ImageFtBbox($pointsize, 0, $fontfile, $string,
array("linespacing" => 1));
$s_width = $string_size[4];
$s_height = $string_size[5];
$i_width = $s_width+2;
$i_height = -1 * $s_height+2;
$im = imagecreate($i_width,$i_height );
....................
do whatever you want ot do with $im and destroy it finally
....................

HTH
-R'twick


----- Original Message -----
From: "Brian V Bonini" <[EMAIL PROTECTED]>
To: "PHP Lists" <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 10:57 AM
Subject: [PHP] image size from text/font size


> Trying to set the image size based on the amount if text/fontsize,
> etc...  Looked through a bunch of the functions but nothing is jumping
> out at me. Does anyone have an example and or can point me to the
> correct function(s) for this.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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

Reply via email to