Page 1 of 1

imagecreate

Posted: Sun May 15, 2005 12:06 pm
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

Posted: Sun May 15, 2005 12:14 pm
by Pyrite
May be try the newline character (\n) ?

Posted: Sun May 15, 2005 2:50 pm
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.