4.14 Image map

You can define multiple links in an image (image file). If you click on the specified point, the coordinate position and the image file name are sent from the Web browser to the Web server. The Web server searches for a URL that corresponds to the image map file and coordinate position, and responds to the Web browser. This is called image map.

To use the image map, you need to define mapping file extension in the imap-file handler.

AddHandler imap-file .map

Organization of this section
(1) Syntax of image map file
(2) Example of image map definition
(3) Note

(1) Syntax of image map file

You can specify the image map data in following three formats:

shape name specification value coordinate
shape name specification value "descriptive text" coordinate
shape name specification value coordinate "descriptive text"

"descriptive text" denotes the explanation sentence when map file menu is displayed and coordinate denotes the coordinates of images.

Table 4-15 describes the shape name and table 4-16 describes the specification value:

Table 4-15 Specification format of shape name and coordinates

Shape nameMeaningSpecification of coordinatesExplanation of coordinates
baseSpecifies base of a relative URL in a map file.None--
defaultSpecifies a link, when figure name is not related to poly, circle, and rect, and point is also not specified.
polySpecifies a polygon having 3 to 100 sides.x1,y1 x2,y2 ... xn,ynEvery coordinate location of polygon (coordinate for 3 to 100 sides)
circleSpecifies a circle. The circle specifies a center point and one point on circumference.x1,y1 x2,y2Coordinates of center point and one point on circumference
rectSpecifies a rectangle. The rect specifies 2 points of opposite corners.x1,y1 x2,y2Coordinates of 2 points of opposite corners
pointSpecifies a point. The point nearest to the cursor is valid.x1,y1Point
Legend:
--: Not applicable.
#
Even if (0,0) is included in the coordinates specification, if you point the coordinates (0,0) of image map image by mouse pointer, the map file menu is displayed.

Table 4-16 Specification values

Specification valuesMeaning
URLSpecifies the link destination. The base and ImapBase directives are enabled in the case of a relative directory.
mapDisplays a map file menu.
menu
refererResponds with the status code 302 Found.
nocontentResponds with the status code 204 No Content. Valid for other than base.
errorResponds with the status code 500 Server Error. Valid for other than base.

(2) Example of image map definition

The operations to use the image map are as follows:

  1. Set the following directives in the httpsd.conf file. Execute the image map when .map extension name is specified in URL.

    AddHandler imap-file .map

    (Define the imap-file handler in the file extension .map)
  2. Define a link destination in the file with the extension defined above.
  3. Describe the following HTML syntax in HTML document.

    <A HREF="/directory name/map file name"><IMG SRC="image data name" ISMAP></A>

The following figure shows an example of image map file definition and actual display:

Figure 4-13 Example of image map filedefinition

[Figure]

In this example, if you click on the part specified with poly, the following map file menu is displayed:

[Figure]

(3) Note

If the character set used in the map file menu differs from the default character set (ISO-8859-1), characters will become garbled in the map file menu display. In this case, specify the character set used in the map file menu in the HWSImapMenuCharset directive.