Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Php: Write Random Text As Image, Having problems, help needed!
Rejected
post Jul 16 2005, 06:50 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 11
Joined: 10-June 05
Member No.: 6,072



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?

This post has been edited by microscopic^earthling: Jul 16 2005, 12:35 PM
Go to the top of the page
 
+Quote Post
szupie
post Jul 17 2005, 02:53 AM
Post #2


S.P.A.M.S.W.A.T.
Group Icon

Group: Members
Posts: 814
Joined: 22-January 05
From: San Antonio, Texas (No, I'm not dumb. I just moved here...)
Member No.: 2,284



You spelled imagettfbbox with an extra a (imaagettfbbox).

And why do you have all your variables start with underscores? You need them only when you want numbers at the beginning of a varible, like $_42lasljwoie. Are you trying to make the variables starting with numbers to look the same as variables starting with letters?
The underscores don't cause a problem, but I'm just curious.
Go to the top of the page
 
+Quote Post
Hercco
post Jul 17 2005, 07:22 PM
Post #3


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228



QUOTE(Rejected @ Jul 16 2005, 08:50 AM)
I'm making a dumb mistake of some sort.
*



The worst ones to debug.


QUOTE(szupie @ Jul 17 2005, 04:53 AM)
And why do you have all your variables start with underscores?
*



It's a coding convention, I've seen that in few other places too. I don't quite get the point, but that's not the first time...
Go to the top of the page
 
+Quote Post
jvizueta
post Sep 15 2005, 06:25 AM
Post #4


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 22
Joined: 13-September 05
Member No.: 8,434



I've seen that coding convention before but only for private methods, and for predefined global variables like $_GET, $_POST, $_SERVER, $_REQUEST, and so on wink.gif

I didn't know it was used for userdefined variables too blink.gif

that's new for me unsure.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. IE6 display:block hides other image BUG(1)
  2. How To Make A Text Based Online Game Script ?(24)
  3. Nero Problems(32)
  4. How Can I Bind Dynamic Text In Flash Animation?(3)
  5. Turkish-to-English Text Translator(6)
  6. How To: Connect, Read, Write, Close A Database(5)
  7. Text File Operations VB.NET(6)
  8. Anyone Know Of Any Good Image Editing Software?(24)
  9. How To Make A Good Sig Image!(6)
  10. Rakion Problems.(2)
  11. Problems Installing Vista(14)
  12. Office 2007 Document Problems(14)
  13. 1 More Administrator Needed For Runescape Forums Website(1)
  14. Help Needed:: Phpbb2 Mod :: Ip Country Flag 2.9.2(2)
  15. Sandisk Memory Card Write Protection(13)
  1. Anyone Willing To Make A Text-based Game With Me?(5)
  2. Image Problems With Windows 2000(10)
  3. Problems With New Computer(10)
  4. Problems Using Usb Devices(7)
  5. Need To Copy An Entire Site..(10)
  6. Help Making A Text Based Game.(7)
  7. 12 Javascript Image Galleries(0)
  8. Random Restarting(12)
  9. Email Server / Cpanel Problems(1)
  10. Suggested Hosting Service For Text Based Game?(2)
  11. Time Functions Needed(9)
  12. Random Questions In Vb..(7)
  13. Myspace Layouts Website, Feedback Needed(0)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 04:18 PM