Skip navigation

STANFORD UNIVERSITY

INFORMATION TECHNOLOGY SERVICES

Image Maps


The server-side imagemap processing allows you to link to other documents using regions based on coordinates in an mage. You can define rectangles, circles and polygons.

Below are instructions for setting up imagemaps. For more detailed information, see the Apache documentation.

What you need to do

Three files are involved:

  1. The image file (typically a GIF file) with your picture
  2. The HTML file containing the reference to the clickable image map
  3. A map file that matches regions in the image to URLs

Define your regions.

Use a graphics program (such as xv) to find the coordinates of the regions in your picture that you would like to map. Rectangles are the easiest - they are defined by their upper left and lower right corners.

Map your regions to URLs

In a file called yourimage.map, include one line for each region/URL match. A simple map file may look like this:

rect /~yourname/lefthalf.html 0,0 210,150 rect /~yourname/righthalf.html 210,0 420,150

Groups, classes, and departments

Tell the server about your map file

You'll need to point the link at your map file :

<A HREF="/~yourname/yourimage.map">
<IMG ISMAP SRC="/~yourname/yourimage.gif"></A>

You also have the option of specifying a default mapping for nothing to happen. You could also give the current URL, but that forces the browser to reload the page. To avoid that, include the line

default nocontent

in your map file. That will cause the server to send the browser a special response telling it not to do anything.

(Replace "yourname" in these examples with your user name. Replace "yourimage" with the name of your image.)

Last modified Thursday, 19-Jan-2006 01:11:03 PM

Stanford University Home Page