Extension:ImageMap (McNaught)

Introduction
Consider Choosing an ImageMap Extension before deciding on which ImageMap extension to use.

ImageMap is a MediaWiki 1.5 extension. This extension was built to add Client Side ImageMaps to MediaWiki.

Note: Most up to date version of this extension can be found at: http://www.chekmate.org/wiki/index.php/Projects

Another version is located at m:User:TeamChaos/HtmlMaps

Note: For MediaWiki 1.9 there is a similar extension: ImageMap. This extension does not use image map information in HTML format loaded from files. Rather, it includes image map information inline between the imagemap tags.

Another version, that includes the functionality of both this extension and the extension in the above note is available on Mediawiki at Imagemap (Alternate). This version provides for full map file checking to exclude any non-map HTML statements. It also provides proper linking to map files in a Wiki Family.

Change History

 * 15:25, 24 July 2006 (UTC) - Extension now configured so it no longer caches the wiki page. (Smcnaught)
 * 02:20, 24 July 2006 (UTC) - If whitespace was in the map file, it created a &lt;pre> underneath the image map graphic. This has been corrected. (Smcnaught)
 * 06:09, 18 July 2006 (UTC) - Added better variable definition for $mapfile using global variable $IP (Smcnaught)
 * 01:56, 18 July 2006 (UTC) - Added Error checking to check if $mapfile exists. (Smcnaught)
 * 01:56, 18 July 2006 (UTC) - Added a random component to timestamp as multiple imagemaps on a single page did not work properly. (Smcnaught)

Maintainer
Shannon McNaught (smcnaught) - I am also available on irc.chekmate.org #MediaWiki

Homepage
ChekMate Technical Focus Group

License
ImageMap.php - Adds ImageMap functionality to MediaWiki

Copyright (C) 2006 Shannon McNaught

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Installation

 * Copy  ImageMap.php  to "extensions" folder.
 * Change " $mapfile = "/var/www/html/$Mapurl";" within file to point to the parent directory where your wiki folder is located.
 * Add a line  require_once( "extensions/ImageMap.php" );  into "LocalSettings.php".
 * Set up MediaWiki to allow users to upload MAP files, set up something like the following in "LocalSettings.php":
 * Was an issue with MediaWiki not accepting the upload. Needed to change $wgVerifyMimeType to false in "./includes/DefaultSettings.php". Better solutions? 

Better solution
Look in Apache's mime.types file. You should find a mime type for text/plain. Add map to it - e.g.: text/plain      asc txt map This will allow basic mime validation as a text file. With this, you do not need to use $wgVerifyMimeType= false; at all.

If this creates a problem with existing *.map files for other uses, then use an extension like mpi instead. Put mpi into $wgFileExtensions and in mime.types. Then use the mpi extension in the

Map File
Make sure the map file contains a map tag with a name attribute. The actual name is not relevant, as it will be replaced with a temporary name when the page is rendered, but the attribute must be available. Example:       

Sample
An online example can be seen at: http://web.archive.org/web/20090416155709/http://www.chekmate.org/wiki/index.php/MW:_ImageMap_Extension (Link is only available through Internet Archive)

ImageMap.php


$wgExtensionFunctions[] = "wfImageMapExtension";
 * 1) install extension hook

function wfImageMapExtension { global $wgParser;
 * 1) extension hook callback function

#install parser hook for

Other sites using this extension

 * ChekMate Technical Focus Group

Imagemapping Tools

 * Clickable Image Map Maker. This web page allows the user to select an image file on his own local hard drive, then creates a second page using that image, and allows the user to very quickly generate the HTML code for an imagemap to be used in his own files. It also offers some handy pop-up menus to speed the process of coding the actual href. Complicated maps can be created in less than a minute (no kidding). Requires a Javascript and frames capable browser, designed and tested on a Mac using Netscape Navigator.
 * Mapedit is a WYSIWYG editor for imagemaps, available for Microsoft Windows and the X Window System. Use Mapedit to generate, or convert to, NCSA, CERN, or client-side map files.