Clickable images like this make use of a "map file" telling the server which coordinates in the image correspond to which document. The format of this file (described below) is the same as that used with the NCSA imagemap program (with a few minor enhancements).
There is a program (which I have not used) called mapedit that is designed to automate this task.
File=image.gifIf your imagemap file redirects the client to other documents on your server make sure they are also installed. Run wndex where necessary to update your index.cache.
File=image.map
Attribute=imagemap
Note: A file named foo.map (i.e. with suffix ".map") will automatically be considerd to have "Attribute=imagemap" set when wndex is run unless a "Content-type=something" line is supplied for it. This will also work if the "serveall" directive is specified for this directory and there is no entry in the index file for foo.map. But it is necessary to run wndex, i.e. the server will not recognize foo.map as an imagemap file if wndex has not been run on the directory containing it.
<a href="image.map">assuming that "image.map", "image.gif" and the file containing this link are all in the same directory.
<img src="image.gif" ismap>
</a>
A complete functioning example of imagemap use, illustrating all the methods is included with the WN distribution.
An imagemap can contain comments which are lines starting with the character '#'. These lines are ignored by the server, as are lines which are blank. All other lines must start with one of the imagemap "method" keywords, i.e., default, rect, circle, poly, or point. Here is a description of each type of method line.
default http://webhost/dir/default.html
rect http://webhost/dir/rect.html 20,20 70,100
Note the coordinates of the rectangle corners consist of the X coordinate (two numbers separated by a comma) followed by whitespace followed by the Y coordinate (two more numbers separated by a comma). This URL will be returned if the clicked on point lies in the rectangle with opposite corners (20,20) and (70,10). In screen coordinates (as opposed to the Cartesian plane) these are the upper left and lower right corners respectively.
circle http://webhost/dir/circle.html 70,70 70,100
This URL will be returned if the clicked on point lies in the the circle with center at (70,70) and radius 30 (i.e. the circle with center (70,70) containing the point (70,100) ).
Technical note: The curve formed in this way may cross itself -- a point will be considered inside if the winding number of the curve around the point is non-zero.
An example is
poly http://webhost/dir/triangle.html 10,20 70,100 5,150
This URL will be returned if the clicked on point lies in the triangle with vertices (10,20) (70,100) and (5,150).
point http://webhost/dir/point1.html 10,20 70,100
point http://webhost/dir/point2.html 100,110 80,5
If no other method has returned a URL then the returned URL will be to point1.html or point2.html depending on whether the clicked on location is closer to one of the points (10.20) or ((70,100) or to one of the points (100,110) or (80,5).
Note: Allowing multiple points on a single point method line is a WN enhancement and will not be portable to other imagemap programs.
nocoords http://webhost/dir/message.txt
Note: The nocoords keyword and functionality is a WN enhancement and will not be portable to other imagemap programs.
http://remote_host/dir/rect.htmlHere are the differences. The first, "http://remote_host/dir/rect.html" is primarily used to link to a document on a remote host. On seeing this the server sends an HTTP redirect to the client causing the client to automatically access this URL.
/dir/rect.html
rect.html
The use of "/dir/rect.html" is equivalent to "http://local_host/dir/rect.html". Any URL specified in a method line which begins with a '/' is assumed to be on the local local host and the path is assumed relative to the WN root directory. An HTTP redirect is sent because simply sending the file would confuse the client (it would think that the document rect.html is in the same directory as the imagemap file which might not be true in which case relative URLs would fail to work). Warning: the WN root directory is changed by use of http://host/~user/ type URLs.
The use of "rect.html" or anything which does not contain ":/" (i.e. which does not start with http://... or ftp://...) and does not start with '/' causes the server to assume that the document is relative to the directory containing the imagemap. In this case the server will immediately serve that document with no redirection. This is the most efficient way to set up an imagemap, but it requires that the response files like "rect.html" be in the same directory as the imagemap file. There is one exception to this. If the relative URL contains a '#' the server prepends the appropriate path to the URL and sends an HTTP redirect to the client. This is necessary for the client to be able to handle the "name" anchor indicated by the '#'.
Note: Allowing relative URLs of this type is a WN enhancement
and will not be portable to imagemap programs run on other servers.
Also note that using a relative URL like "dir/rect.html" referring to
a document in a subdirectory can confuse a browser about the location
of documents referred to in rect.html. For this reason it should only
be used when the document is not an HTML document or contains a
There is one special URL which may be used in map files, namely "<null>". It has the effect of not sending a redirect or a document to the client but instead sending a header with status 204. This instructs the client to do nothing and in particular not to reload or alter the document it is displaying. For example, the line
default <null>
in a map file will have the effect of making clicks in the default area behave as if the click had been somewhere outside the image, i.e. nothing will happen. Note: the <null> URL is a WN enhancement and will not be portable to imagemap programs run on other servers.