Det ser sådan her ud nu, skal bare have lavet sådan at det tjekker om pladsen er tilmeldt i databasen.
<?php
//http://www.eksperten.dk/spm/730567
function LoadJpeg($imgname)
{
$im = @imagecreatefromjpeg($imgname); /* Attempt to open */
if (!$im)
{
/* See if it failed */
$im = imagecreatetruecolor(150, 30); /* Create a black image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
$img = '
http://www.vhcamp.dk/pladser2.jpg';$pladser = array();
//X, Y, Height, Width, 1 = green & 0 = red
$pladser[1] = array(168,0,213,26,1);
$pladser[2] = array(214,0,257,26,0);
$pladser[3] = array(175,64,216,96,1);
$pladser[4] = array(218,64,259,96,0);
$pladser[5] = array(261,64,301,96,1);
$pladser[6] = array(303,64,343,96,1);
$pladser[7] = array(175,98,216,130,1);
$pladser[8] = array(218,98,259,130,1);
$pladser[9] = array(261,98,301,130,1);
$pladser[10] = array(303,98,343,130,1);
$pladser[11] = array(371,31,403,72,1);
$pladser[12] = array(371,74,403,114,1);
$pladser[13] = array(371,116,403,157,1);
$pladser[14] = array(371,159,403,200,1);
$pladser[15] = array(427,31,459,72,1);
$pladser[16] = array(427,74,459,114,1);
$pladser[17] = array(427,116,459,157,1);
$pladser[18] = array(427,159,459,200,1);
$pladser[19] = array(478,31,510,72,1);
$pladser[20] = array(478,74,510,114,1);
$pladser[21] = array(478,116,510,157,1);
$pladser[22] = array(478,159,510,200,1);
$pladser[23] = array(534,31,566,72,1);
$pladser[24] = array(534,74,566,114,1);
$pladser[25] = array(534,116,566,157,1);
$pladser[26] = array(534,159,566,200,1);
$pladser[27] = array(7,234,48,266,1);
$pladser[28] = array(50,234,91,266,1);
$pladser[29] = array(93,234,133,266,1);
$pladser[30] = array(135,234,176,266,1);
$pladser[31] = array(7,268,48,300,1);
$pladser[32] = array(50,268,91,300,1);
$pladser[33] = array(93,268,133,300,1);
$pladser[34] = array(135,268,176,300,1);
$pladser[35] = array(204,234,245,266,1);
$pladser[36] = array(247,234,288,266,1);
$pladser[37] = array(290,234,330,266,1);
$pladser[38] = array(332,234,373,266,1);
$pladser[39] = array(204,268,245,300,1);
$pladser[40] = array(247,268,288,300,1);
$pladser[41] = array(290,268,330,300,1);
$pladser[42] = array(332,268,373,300,1);
$pladser[43] = array(399,234,440,266,1);
$pladser[44] = array(442,234,483,266,1);
$pladser[45] = array(485,234,525,266,1);
$pladser[46] = array(527,234,568,266,1);
$pladser[47] = array(399,268,440,300,1);
$pladser[48] = array(442,268,483,300,1);
$pladser[49] = array(485,268,525,300,1);
$pladser[50] = array(527,268,568,300,1);
$myImage = LoadJpeg($img);
$green = imagecolorallocate($myImage, 0, 255, 0);
$red = imagecolorallocate($myImage, 255, 0, 0);
$black = imagecolorallocate($myImage, 0, 0, 0);
foreach($pladser AS $nummer => $plads)
{
$x1 = $plads[0];
$y1 = $plads[1];
$x2 = $plads[2];
$y2 = $plads[3];
$xt = ($x1+$x2)/2;
$yt = ($y1+$y2)/2;
$color = ($plads[4] == 0)? $red : $green;
imagefilledrectangle($myImage, $x1, $y1, $x2, $y2, $color);
imagestring($myImage, 5, $xt, $yt, $nummer, $black);
}
header("Content-type: image/jpeg");
imagepng($myImage);
imagedestroy($myImage);
?>