imagecreate

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SidewinderX
Forum Contributor
Posts: 407
Joined: Fri Jul 16, 2004 9:04 pm
Location: NY

imagecreate

Post by SidewinderX »

im working on making a dynamic sig and i found the imagecreate function to basically do what i want and im sure it can do exactley what i want it to do its just that im not quite sure how to do it...

so far i got this code

Code: Select all

<?php
$db = mysql_connect("localhost", "", ""); 
mysql_select_db("extreme_statsig",$db);
$result = mysql_query("SELECT * FROM statsig",$db);

while ($row = mysql_fetch_assoc($result))
{
extract($row);

header ("Content-type: image/png");

$img_handle = ImageCreate (450, 120) or die ("Cannot Create image");

$back_color = ImageColorAllocate ($img_handle, 0x00, 0x00, 0x00);

$txt_color = ImageColorAllocate ($img_handle, 0xFF, 0xFF, 0xFF);

ImageString ($img_handle, 31, 5, 5,  "Player: $player Exp Points: $experience_points", $txt_color);

ImagePng ($img_handle);
}
?>
(im calling the information out of a database so instead of the information on the sig updating immeditally it will update every hour to use less bandwidth)

Right now i have two questions reguarding this

My sig background is black...how can i make it an image (bg.png or gif) rather then a color?

Second, on the sig is prints the information like this
Player: Sidewinder Exp Points: 1000
i want Player: Sidewinder and Exp Points to be on two different lines like this
Player: Sidewinder
Exp Points: 1000
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

May be try the newline character (\n) ?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Something I wrote a while ago: http://www.ooer.com/index.php?section=php&id=9

That should cover most of what you need.
Post Reply