As an interesting example of generating clickable image maps on the fly, let’s create a web page that will be driven by what we’ll call a wander engine.The web page will allow the user to wander through a landscape by clicking on directional links, and the changing landscape will appear as a dynamically generated image (see Figure 8.5). Each landscape area will be called a room. Each room can contain objects that will be overlaid on the background by the CGI script that dynamically creates the image (the background used in this example is pictured in Figure 8.6 and the three objects are in Figure 8.7). The composite image will be an image map where each of the objects can be clicked on to perform some action.
Figure 8-5. The wander engine allows the user to navigate a landscape with objects by clicking on navigational links or on the objects themselves
Figure 8-6. The background image for room 3 of the “wander”
Figure 8-7. The image files for objects 2, 3, 4, and 6 in the example
All of the information about a room is contained in the rooms.db database. For this example, the database will be implemented using Shishir Gundavaram’s Sprite ...