I have this script:
<?
// scoreboard.php
// Builds a scoreboard display
// from text passed in $text
//
// example: scoreboard.php?text=TEXANS 34
//
//
Header("Content-type: image/png");
$font = 'dotmatrx.ttf';
if(!isset($s))
$s=15;
$size = imagettfbbox($s, 0, $font, $text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=10;
$ypad=4;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$black = ImageColorAllocate($im, 0,0,0);
$yellow = ImageColorAllocate($im, 255,255,0);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
if (strpos($text, ',') > 0 ) {
$yfudge = ($ypad/2)-4;
} else {
$yfudge = ($ypad/2);
}
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+$yfudge, $yellow, $font, $text);
Imagepng($im);
ImageDestroy($im);
?>
How can I call the above from my counter script to return
the image with the counter number?
here's my counter script:
<?php
if (file_exists("counter.txt"))
{
$fp = fopen("counter.txt", "r");
$counter = fgets($fp, 999);
$tmp = $counter;
fclose($fp);
$fp = fopen("counter.txt", "w");
fwrite($fp, $tmp+=1);
fclose($fp);
}
$counter = number_format($counter);
// I want to call the scoreboard.php script above
// with the $counter variable:
?>