Welcome to WebmasterWorld Guest from 18.208.159.25

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Dynamic Images

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

Junior Member

10+ Year Member

joined:Apr 11, 2004
posts:71
votes: 0


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?

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

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3



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

What do you mean by this, quozt?

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


Maybe this will help:

[php.net...]