<?php


	header('Content-Type: image/gif');
	$image = ImageCreate(82, 15);
	ImageColorAllocate($image, 1, 1, 220);

	$gray = ImageColorAllocate($image, 98, 98, 98);

	ImageLine($image, 0, 0, 82, 0, $gray);
	ImageLine($image, 0, 14, 82, 14, $gray);

	ImageLine($image, 0, 1, 0, 13, $gray);
	ImageLine($image, 81, 1, 81, 13, $gray);

	for($i = 1; $i <= 13; $i++)
	{
		$ch = $i * 7 + 150;
		$color = ImageColorAllocate($image, 77, 77, 77);

		ImageLine($image, 1, $i, 100, $i, $color);
	}

	$max = round(intval($_GET['max']));
	$now = round(intval($_GET['now']));
	$string = ($now > 0.5) ? (80 / ($max / $now)) : 0;
    $health = (int)(($now*100)/($max));
	for($i = 1; $i <= 13; $i++)
	{
		$ch = $i * 10 + 120;
		$color = ImageColorAllocate($image, $ch, 0, 0);

		ImageLine($image, $string, $i, 1, $i, $color);
	}

	$white = ImageColorAllocate($image, 255, 255, 255);
	ImageTtfText($image, 8, 0, 11, 12, $white, 'comic.ttf', $health.'% '.$now.'/'.$max);

	ImageGif($image);
	ImageDestroy($image);


?>