Re: image size from text/font size

From: Date: Mon, 03 Feb 2003 16:03:38 +0000
Subject: Re: image size from text/font size
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134139@lists.php.net to get a copy of this message
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" <b-bonini@cox.net> To: "PHP Lists" <php-general@lists.php.net> 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 > >

« previous php.general (#134139) next »