Forum Moderators: coopster

Message Too Old, No Replies

Dynamic Images

         

quozt

9:54 pm on Jan 18, 2005 (gmt 0)

10+ Year Member



ok im creating a script which gets the users login name and makes it an image with a font which works... so anyway heres my code

$text = $_SESSION['username'];
$width = 23 * strlen($text);
$im = @imagecreate ($width,30)or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 150, 174, 101);
$text_color = imagecolorallocate($im, 225,225, 225);
$black = imagecolorallocate($im, 0, 0, 0);
imagettftext($im, 20, 0, 0, 20, $black, "arial.ttf", $text);
imagepng($im);
imagedestroy($im);

the only problem is that the length of the text is really off sometimes...
is there anyway i can sort this out?

coopster

1:18 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




the only problem is that the length of the text is really off sometimes...

What do you mean by this, quozt?

Birdman

10:12 pm on Jan 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe this will help:

[php.net...]