O'Reilly logo

Programming Web Graphics with Perl and GNU Softwar by Shawn Wallace

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Image Maps

Image maps allow a web developer to associate actions with regions of an image. A user’s click may activate a link to another page, run a server-side script, or launch a client-side JavaScript program. In the typical nerdy hipster parlance of the Web, these regions are known as “hot spots.”

The requirements for a working image map are:

  • An image that can be included as an inline image on a web page (generally this means GIF, JPEG, or PNG).

  • Some means of displaying the image and finding the coordinates of the regions you want to define.

  • If a client-side map, a <MAP> element in the same document that defines the regions of the image map.

  • If a server-side map, a map file on the server that defines the regions of the image map in a format that the server recognizes.

  • If a server-side map, an image map program that handles the resolution of the region from the coordinate clicked by the user (most web servers now come with this program preconfigured or built-in, so you probably don’t have to worry about it).

The most difficult part of dealing with image maps from a programming or automation point of view is the generation of the coordinates for the regions within the image. This generally requires some intervention by the author. There are some ways of setting up a site so that certain types of image maps may be generated automatically.

Several people and companies have created tools for making it easier to designate regions within an image map. A few of these free or inexpensive ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required