I am trying to create a dynamic image for the front page of a site, and instead of displaying its just coming up with the good old IE red-x!
I'm sure I must have done something wrong:
Code: Select all
<?php
ob_start();
header("Content-type: image/png");
$img = "images/serverstats.png";
$img_handle=imageCreateFromPNG($img);
$color=ImageColorAllocate($img_handle, 0x31, 0x2E, 0xA3);
/* Get values from DB and turn into variables */
$sql=mysql_query("select count(*) from tc_services") or die(mysql_query());
$result=mysql_fetch_array($sql);
$serverno=$result['0'];
$sql1=mysql_query("select sum(slots) from tc_services") or die(mysql_query());
$result1=mysql_fetch_array($sql1);
$slotcount=$result1['0'];
$sql2=mysql_query("select count(*) from tc_games") or die(mysql_query());
$result2=mysql_fetch_array($sql2);
$sgames=$result2['0'];
$sql3=mysql_query('select count(*) from tc_servers where user_id != ""') or die(mysql_query());
$result3=mysql_fetch_array($sql3);
$dediservers=$result3['0'];
/* End variables */
ImageString($img_handle, 2, 10, 20, $serverno, $color); //just testing one of the variables to start with
ImagePng($img_handle);
ImageDestroy($img_handle);
?><img src="serverstats.php" />
All the files are in the right place, and the db connection is created in the original file, and that works... Just cant display the image??