|
|
|
| Web Hosting |
![]() ![]() |
Php: Write Random Text As Image, Having problems, help needed! |
Jul 16 2005, 06:50 AM
Post
#1
|
|
|
Newbie [ Level 2 ] 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( [tab][/tab]"Test 1", [tab][/tab]"Test 2", [tab][/tab]"Test 3", [tab][/tab]"Test 4", [tab][/tab]"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 |
|
|
|
Jul 17 2005, 02:53 AM
Post
#2
|
|
|
S.P.A.M.S.W.A.T. 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. |
|
|
|
Jul 17 2005, 07:22 PM
Post
#3
|
|
|
Super Member Group: Members Posts: 595 Joined: 4-September 04 Member No.: 228 |
QUOTE (Rejected @ Jul 16 2005, 08:50 AM) The worst ones to debug. QUOTE (szupie @ Jul 17 2005, 04:53 AM) 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... |
|
|
|
Sep 15 2005, 06:25 AM
Post
#4
|
|
|
Newbie [ Level 2 ] 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
I didn't know it was used for userdefined variables too that's new for me |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
38 | Bio | 8,504 | Yesterday, 05:41 PM Last post by: themetabs |
|||
![]() |
11 | sendto | 6,941 | 26th December 2008 - 12:59 PM Last post by: iG-nwaynge |
|||
![]() |
0 | zainboy | 95 | 25th December 2008 - 08:50 PM Last post by: zainboy |
|||
![]() |
4 | CiaraMarie | 2,182 | 23rd December 2008 - 08:24 PM Last post by: iG-Lucky |
|||
![]() |
26 | iciclez | 3,304 | 21st December 2008 - 10:30 AM Last post by: Quatrux |
|||
![]() |
15 | rmdort | 4,467 | 20th December 2008 - 05:38 AM Last post by: laniczech |
|||
![]() |
14 | Mr 85 | 1,654 | 17th December 2008 - 03:44 PM Last post by: ryantommo |
|||
![]() |
3 | nighthawk16 | 2,261 | 14th December 2008 - 05:51 PM Last post by: iG-Kudos |
|||
![]() |
2 | denverporia19 | 1,862 | 11th December 2008 - 10:36 PM Last post by: iG-Marble |
|||
![]() |
11 | ViRuaL | 2,360 | 10th December 2008 - 10:14 PM Last post by: iG-nick |
|||
![]() |
13 | Scionwest | 4,808 | 6th December 2008 - 11:34 PM Last post by: iG-Levi |
|||
![]() |
8 | Mico | 456 | 2nd December 2008 - 07:14 AM Last post by: The_Fury |
|||
![]() |
3 | Sir Joe | 2,023 | 2nd December 2008 - 03:14 AM Last post by: iG-Ben and Hank |
|||
![]() |
16 | jc804 | 2,335 | 1st December 2008 - 02:13 PM Last post by: iG-Sharon |
|||
![]() |
6 | miCRoSCoPiC^eaRthLinG | 1,986 | 29th November 2008 - 02:24 PM Last post by: yordan |
|||
|
Lo-Fi Version | Time is now: 8th January 2009 - 01:20 AM |
© 2009 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Jul 16 2005, 06:50 AM






