next up previous contents
Next: CERN HTTPD's Htimage Up: Imagemap Configuration Previous: Imagemaps using MacHTTP

NCSA HTTPD's Imagemap Command

NCSA's HTTPD has a special directory called cgi-bingif in which you can put commands you want to be accessible by the server. One of the pre-supplied commands is imagemap, which is a much more sophisticated active map facility.

If we had the following lines of HTML in a document

<a href=/cgi-bin/imagemap/uk_map>
<img src=uk_map.gif ISMAP>

then when the user clicked on at (say) point (404,451), the client would submit a GET request to the server:

GET /cgi-bin/imagemap/uk_map?404,451

This calls the imagemap script in cgi-bin with two pieces of information - the QUERY_STRING environment variable with a value of ``404,451'' and the PATH_TRANSLATED environment variable with a value such as
`` /www/htdocs/uk_map'' (where `` /www/htdocs'' is the root of the server's document tree).

HTTPD has a configuration directory called `` conf''gif which contains all the server configuration files. Imagemap looks in this directory for a file called imagemap.conf.

In our particular case (we have a few image maps set up), this configuration file looks like:


Imagemap reads this file, and looks for `` uk_map'', which it finds associated with the file `` /www/conf/''. It then reads from `` /www/conf/'', of which the first few entries look like:

circle 416 451 396 458
circle 442 463 428 459
circle 413 405 400 407
circle 337 312 341 311
rect 335 317 372 325
rect 335 387 394 397

Each of these lines describes an active area of the map and the URL associated with that area (lines beginning with a `` #'' are comments).

The first entry on a line describes the shape of the active area. The second entry is the URL to redirect the client to if the user clicks within this area. The last arguments give the coordinates of the shape. The meaning of the coordinates is as follows:

default URL

This gives the URL to go to if the user clicked outside all of the specified shapes.
rect URL x1 y1 x2 y2

This specifies a rectangle with upper left corner (x1,y1) and lower right corner (x2,y2).
circle URL x1 y1 x2 y2

This specifies a circular hot spot with centre (x1,y1) and a point of the edge of the circle (x2,y2).
poly URL x1 y1 x2 y2 ... xn yn

This specifies a hot polygon with vertices (x1,y1) ... (xn,yn). The polygon is automatically closed is the first and last vertices are not the same.

Imagemap will run through the file and redirect the client to the URL of the item that best matches (with the exception of ``default'', which only matches if nothing else does).

next up previous contents
Next: CERN HTTPD's Htimage Up: Imagemap Configuration Previous: Imagemaps using MacHTTP

Jon Crowcroft
Wed May 10 11:46:29 BST 1995