One way to think about imagemaps is that they are like transparencies that may be placed over the image. One then identifies regions in the underlying image where the anchor is to be located and marks those locations on the transparency. When a user points with the mouse to some place within one of the regions and clicks, the associated anchor is followed, like pointing to a textual anchor and clicking to follow that link. A major difference, however, is that current Web browsers do not visibly indicate the regions where image anchors are located. So, users just have to click someplace and see what happens. In practice, this limitation is not so bad as it may first seem, since imagemaps are often used with respect to graphic representations of buttons, maps of the US, and other similar visual data where some sort of "natural" association between region and anchor is apparent.
This discussion will be based on the NCSA HTTPD server, v. 1.4.2. See NCSA's Imagemap Tutorial for detailed documentation.
For imagemaps, the Web server uses a special program, called imagemap, that does all the magic associated with imagemaps. The way the server knows that the imagemap program is to be called is that it runs across the keyword, imagemap, in the path of the URL within an executable directory, such as cgi-bin.
After encountering the keyword, imagemap, it then treats the rest of the path in the URL in a special way, which will be described below, to locate a map file. The map file contains the mapping between a designated region of the image and a URL to be followed when that region is selected by the user.
While some browsers support other types of images, GIF is the current "common denominator". So, the first thing to do is locate a GIF image. It can be one you create, using a paint, drawing, other image application; it can be one you scan in; or it can be someone else's image for which you have the URL. If you create an image using a drawing application, you may have to save it in some intermediate format (e.g., PICT2) and then convert it to GIF.
Different servers use different conventions for designation regions and their associated URLs. This discussion will be based on the NCSA HTTPD server, v. 1.4.2.
The map file consists of lines that include three fields:
The easiest way to create a map file is to use a tool such as WebMap. It allows you to display a GIF image and then draw regions over the image using rectangles, circles, and other conventional drawing tool forms. Once a region is identified, you can then add the URL to be associated with that region. When the data are saved, WebMap creates a map file that includes the URL and the designated region.
Tools for other platforms can be found through Yahoo's Imagemap Directory.
Also, be aware that the conventions for specifying map files for the Web server assumed here (NCSA HTTPD v.1.4.2) are different from those of other servers and for earlier versions of the NCSA HTTPD server.
Go to course homepage