|
|
|
|
![]() ![]() |
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( "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 |
|
|
|
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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 04:18 PM |