Kane Hart
12.03.2007, 21:04
My goal is to have this image here I can make a jpg or another version if needed but this picture here to work with php gd script show how many players are online..
http://gamingtown.net/z/playersonline.gif
I already did most the work but need someone help me finish the rest.
Heres an example: http://gamingtown.net/z/test.php
heres the code:
<?php
header ("Content-type: image/png");
//$im = imagecreatefrompng("playersonline.png");
$im = @ImageCreateFromPNG ("playersonline.png");
if(!$im) {
$img_handle = ImageCreate (200, 20) or die ("Cannot Create image");
$back_color = ImageColorAllocate ($img_handle, 0, 10, 10);
$txt_color = ImageColorAllocate ($img_handle, 235, 235, 51);
$myFile = "online.txt";
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
fclose($fh);
ImageString ($img_handle, 10, 25, 5, "Players Online: $theData", $txt_color);
ImagePng ($img_handle); }
Else {
echo "Image is Found"; }
?>
Any help would be great not sure how add a background image with gd I taken this from another site and mod it a lot.. Learned how withdraw info from text file..
Its working great but want know how make work in that image above.
Thanks for all your help :)
http://gamingtown.net/z/playersonline.gif
I already did most the work but need someone help me finish the rest.
Heres an example: http://gamingtown.net/z/test.php
heres the code:
<?php
header ("Content-type: image/png");
//$im = imagecreatefrompng("playersonline.png");
$im = @ImageCreateFromPNG ("playersonline.png");
if(!$im) {
$img_handle = ImageCreate (200, 20) or die ("Cannot Create image");
$back_color = ImageColorAllocate ($img_handle, 0, 10, 10);
$txt_color = ImageColorAllocate ($img_handle, 235, 235, 51);
$myFile = "online.txt";
$fh = fopen($myFile, 'r');
$theData = fgets($fh);
fclose($fh);
ImageString ($img_handle, 10, 25, 5, "Players Online: $theData", $txt_color);
ImagePng ($img_handle); }
Else {
echo "Image is Found"; }
?>
Any help would be great not sure how add a background image with gd I taken this from another site and mod it a lot.. Learned how withdraw info from text file..
Its working great but want know how make work in that image above.
Thanks for all your help :)