#!/usr/bin/perl # Finds location in image map and generates the box of the image. $mapdata = "/home/www/htdocs/maps/napatown.map"; # Clear the buffer $|++; #Get the passed region information from the activate.pl script require './cgi-lib.pl'; &ReadParse(*form); #assign region number to n for comparison through map file $n = $form{'region'}; # $n = 110; open (FILE,"$mapdata") || die "Can't open $mapdata: $!\n"; while () { if (/#$n\s*(\d.*)/) { $coords = $1; } } use GD; $mapimage = "/home/www/htdocs/bbd/pictures/napamap.gif"; open (GIF,"$mapimage"); $myimage = newFromGif GD::Image(GIF) || die; close GIF; $green = $myimage -> colorAllocate(0,0,255); $poly = new GD::Polygon; @datapairs = split (/ /,$coords); # print join(" ",@datapairs),"\n"; foreach $pointset (@datapairs) { ($x,$y) = split (/,/,$pointset); $poly -> addPt ($x,$y); } #($x,$y) = split (/,/,$datapairs[0]); # $poly -> addPt($x,$y); $myimage -> filledPolygon ($poly,$green); print "Content-Type: image/gif\n\n"; print $myimage -> gif;