|
|
|
|
![]() ![]() |
Jul 16 2005, 08:18 AM
Post
#1
|
|
|
{([Mod])} ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 710 Joined: 30-October 04 From: Texas Member No.: 2,058 |
I'm trying to create a script that writes text to an image.
CODE header("Content-type: image/png"); $_phrases = array( "Test 1", "Test 2", "Test 3", "Test 4", "etc." ); $_rand_phrase = $_phrases[rand(0,count($_phrases)-1)]; $_image = imagecreatefrompng("gmail.png"); $_user_width = imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value = (200-($user_width[2] + 113)); $_color = imagecolorallocate($_image, 165, 164, 164); imagettftext($_image, 9, 0, $_x_value, 16, $_color, "tahoma.ttf", $_rand_phrase); imagepng($_image); imagedestroy($_image); I can't see what I'm doing wrong.. I know it should work, I'm making a dumb mistake of some sort. Can anyone help? |
|
|
|
Jul 16 2005, 11:19 AM
Post
#2
|
|
|
apt-get moo ![]() Group: [MODERATOR] Posts: 2,235 Joined: 28-May 05 From: Devon, England Member No.: 7,593 ![]() myCENT:5.98 |
I just made a similar script for a friend, one of those interactive sigs with the IP and all that on it. Anyway, try using
CODE imagestring($_image, 3, 6, 6, $Title, $clr_black); //It works like this: imagestring($_image, FONT, X-POSITION, Y-POSITION, TEXT-TO-DISPLAY, COLOUR); rather than imagettftext. Also, try removing the _ from the variables as I have seen that confuse some set ups of PHP before. What exact error do you get when you run the script, or do you just get a blank page? |
|
|
|
Jul 16 2005, 03:35 PM
Post
#3
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
If you want to make dynamic sigs, you could follow SystemWisdom's tutorial: http://www.trap17.com/forums/php-dynamic-s...res-t24458.html
|
|
|
|
Jul 16 2005, 06:58 PM
Post
#4
|
|
|
{([Mod])} ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 710 Joined: 30-October 04 From: Texas Member No.: 2,058 |
Thanks, about to try rvalkass's and then if it fails I'll try that tutorial Nguyen.
There isn't an error, it just says that the iamge can't be displayed because it was errors. |
|
|
|
Jul 16 2005, 07:20 PM
Post
#5
|
|
|
Moderator ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,325 Joined: 8-March 05 From: Mawson, Antarctica Member No.: 4,254 |
QUOTE(rejected @ Jul 16 2005, 03:58 PM) Oh no. Are you calling me "Nguyen", too?? Sorry! I clicked edit instead of post.. This post has been edited by rejected: Jul 16 2005, 08:37 PM |
|
|
|
Jul 16 2005, 08:38 PM
Post
#6
|
|
|
{([Mod])} ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 710 Joined: 30-October 04 From: Texas Member No.: 2,058 |
Sorry about that...darn edit button..
I'll only call you Nguyen if allowed..if not I'll call you Guy And thanks for the link to the tut, it helped me fix one of my problems |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 05:27 AM |