Extension:ImageMapConversion

What can this extension do?
The Image Map Conversion Special Page is used to convert HTML format image map information into inline Imagemap format. The input to this utility can be:
 * HTML code containing image map information
 * Files created by image map utilities (listed below) containing image map HTML code
 * Files compatible for input to file-based image maps or to Shannon McNaught's extension

The output can be used in:
 * My alternate extension
 * Tim Starling's extension

This Special Page can make it easy to convert your wiki from McNaught's extension to one of the inline extensions. It also allows you to use many different HTML utilities to generate the image map data from an image.

Usage
When you open the page, you will see an text input line for a local file under the header Source filename:. Input a valid path and file name for a local file containing image map HTML statements. Alternatively, click the Browse button and use the local computer's file dialog to select a local file.

If the file contains both and  HTML statements, you can select Allow mixed  and  tags to be converted if you wish both sets to be converted. If you do not select this option, area atatements will be ignored and only  statements will be converted (as per W3 standards).

When you have input the required file path and name and checked or unchecked the selection, click on Submit. The text area below the input area will display either an error message or the converted output.

In order to use the output, mark the converted text and copy the content. Paste the content onto the page you are creating and add the remaining information.

Note:
 * This extension assumes the file supplied by the user contains valid, functioning HTML. This extension does not validate or correct the HTML.  If the HTML contains errors. the resulting output cannot be assured to be any good.
 * You can specify an entire web page HTML file. Only the first set of map statements will be processed.  If more than one set of map statements exist and you wish to convert them all, you will have to split the file into parts with one set of map statements in each.
 * All statements outside of and are ignored.
 * All statements between and that are not map related statements will be converted to comments preceded by a #.
 * Links in an HTML file are either relative or absolute URLs. You will likely have to change these to either local page links or to absolute URLs to be used in the imagemap extension.
 * Some image map utilities will put a default area statement in the HTML file. It will look something like     If this default area statement has no href, you will get an error.  Either change the file so it has a valid href or delete the unusable default area statement.
 * Due to security provisions in HTML, it is not possible to keep the path and filename the user inputs displayed in the input field after the page is submitted. For this reason, the input path and filename is copied to another text field below the Submit button.  This will allow the user to copy this string back into the input field rather than having to work though the client's operating system file dialogs.

Installation
1) Create a folder in the wiki hierarchy under the /extensions/ folder:

..../yourwiki/extensions/ImageMapConversion

2) Place all the downloaded files in the ImageMapConversion folder.

3) Add the following line to the LocalSettings.php file:

require_once( "$IP/extensions/ImageMapConversion/ImageMapConversion.php" );

4) Edit Mediawiki:Common.js


 * Note: you edit this file by putting the text "Mediawiki:Common.js" after index.php in your wiki's URL. E.g.:

http://your.wiki/index.php/Mediawiki:Common.js.


 * and add the following JavaScript to the file:

/* START of javascript for the ImageMapConversion extension  */ function imagemapGetFilePathAndName { document.getElementById('localfile').value = document.getElementById('inputHtml').value; return; } /* END of javascript for the ImageMapConversion extension  */
 * If you are using this with an older version of Mediawiki (prior to 1.9) you must put this code in "Mediawiki:Monobook.js" instead. I have not tested this.

5) If you are using the ImageMap (Alternate) extension, ensure that you update it to the latest version. If you receive a PHP error that a function in php is already defined, that may mean you are using an older version of ImageMap (Alternate).

Changes to LocalSettings.php
Add the following to the end of the LocalSettings.php file:

require_once( "$IP/extensions/ImageMapConversion/ImageMapConversion.php" );

Download
While this special page extension is in beta, please download the files from: my SVN site

HTML Image Map Generators
There are utilities available that will generate the map and area statements with the coordinate data. You can specify the image and select points on the image to define a shape. The utility will calculate the coordinates of these points and write out the appropriate HTML statements. This makes it easy to generate the map files. Here are a few examples - none of these are specifically sanctioned and are only offered as suggestions. You can use a search engine to find others.


 * 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.
 * Meracl ImageMap Generator is a free map Imagemap generator.
 * GIMP - The GNU Image Manipulation Program