I am attempting to make a counter using GD v2.0. I have everything working, right up to when it is supposed to show the image. It is pulling information out of the database, and updating it with the new count, but I am getting the missing image box instead of the counter. I have been looking through this code endlessly, and I can't find any problem with it. I'm hoping a set of fresh eyes will do the trick.
Here is the code that is getting called:
<?php
$include_dir = $_SERVER['DOCUMENT_ROOT'] . "/fms/includes/";
$include_config = $include_dir . "config.php";
$include_sql = $include_dir . "sql_connect.php";
require($include_config);
require($include_sql);
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM bcd_counter WHERE id='$id'") or die(mysql_error());
$row = mysql_fetch_array($result);
$counter = $row['counter'];
$font_num = $row['font_num'];
$br = $row['br'];
$bg = $row['bg'];
$bb = $row['bb'];
$fr = $row['fr'];
$fg = $row['fg'];
$fb = $row['fb'];
$counter++;
$result = mysql_query("UPDATE bcd_counter SET counter='$counter' WHERE id='$id'") or die(mysql_error());
while(strlen($counter) < 6) {
$counter = "0" . $counter;
}
$font_dir = $_SERVER['DOCUMENT_ROOT'] . "/gdf/";
$font_type[1] = "04b.gdf";
$font_type[2] = "almosnow.gdf";
$font_type[3] = "anonymous.gdf";
$font_type[4] = "automatic.gdf";
$font_type[5] = "azimov.gdf";
$font_type[6] = "betsy.gdf";
$font_type[7] = "borringlesson.gdf";
$font_type[8] = "bubblebath.gdf";
$font_type[9] = "checkbook.gdf";
$font_type[10] = "chinyen.gdf";
$font_type[11] = "christmaxlightoutside.gdf";
$font_type[12] = "crackman.gdf";
$font_type[13] = "crass.gdf";
$font_type[14] = "cry.gdf";
$font_type[15] = "ennobled.gdf";
$font_type[16] = "festival.gdf";
$font_type[17] = "scarabo.gdf";
$font_type[18] = "sfballoon.gdf";
$font_type[19] = "xtrusion.gdf";
$font_name = $font_dir . $font_type[$font_num];
$font = imageloadfont($font_name);
$fontWidth = imagefontwidth($font);
$fontHeight = imagefontheight($font);
$im = imagecreate(strlen($string) * $fontWidth, $fontHeight);
$background = imagecolorallocate($im,$br,$bg,$bb);
$drawfontcolor = imagecolorallocate($im,$fr,$fg,$fb);
imagestring ($im, $font, 0, 0, $counter, $drawfontcolor);
header ("Content-type: image/png");
imagepng($im);
imagedestroy($im);
?>
And here is the code that I am putting on the page.
<img src="http://www.bluecollardigital.com/makefont_showcounter.php?id=1">
Thank you guys for any help you can provide.