Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Write Random Text To Image, PHP script help!
rejected
post 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?
Go to the top of the page
 
+Quote Post
rvalkass
post Jul 16 2005, 11:19 AM
Post #2


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,235
Joined: 28-May 05
From: Devon, England
Member No.: 7,593
Spam Patrol
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?
Go to the top of the page
 
+Quote Post
snlildude87
post 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
Go to the top of the page
 
+Quote Post
rejected
post 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.
Go to the top of the page
 
+Quote Post
snlildude87
post 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)
and then if it fails I'll try that tutorial Nguyen.
*

Oh no. Are you calling me "Nguyen", too?? laugh.gif

Sorry! I clicked edit instead of post.. huh.gif

This post has been edited by rejected: Jul 16 2005, 08:37 PM
Go to the top of the page
 
+Quote Post
rejected
post 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 biggrin.gif

And thanks for the link to the tut, it helped me fix one of my problems smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Many Php Script Sites(16)
  2. Script: Php Jukebox(6)
  3. Parse: Error Unexpected T_lnumber(4)
  4. Transfer Variables To Another Php Script(9)
  5. Dynamic Image / Signature Generator(12)
  6. Watermark Your Image With Simple Php Script(35)
  7. Wappychat_oldskool(15)
  8. Free Auction Script(6)
  9. Wappy Buddy V1.10 - Tibia Gold Edition By Wappy & Jon Roig(3)
  10. What Kind Of Script Do You Need ?(15)
  11. Creatting A Playlist Through Php(5)
  12. Very Simple Online Now Script(4)
  13. Html Code Tester. Online Script(15)
  14. Php Downloads Script(4)
  15. Script Help Required: Undefined Variable(3)
  1. Library Script(6)
  2. How Would I Go About Making A Simple "counting" Script?(3)
  3. Forum Script(3)
  4. Php Rediret Script(12)
  5. Download Script For Mp3 Files(0)
  6. How Do I Connect To Live Database With Php Script?(6)
  7. Need Help Installing Dolphin Community Script!(5)
  8. Image Upload(11)
  9. Guessing Php Script(2)
  10. How To Make A View New Post Script?(5)
  11. Php Guest Online Script(3)
  12. How To Make Php Newsletter Script(3)
  13. Php - Fetching Random Line From A Text File(0)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 05:27 AM