Extension talk:ImageMapConversion

Updated for MW 1.11
I noticed a slight problem with MW1.11 - an error message due to one function (loadMessages) not returning a valid value. It now returns true.

If you choose to upgrade, just download and replace ImageMapConversion_body.php; it's the only one with a change in the code.

--Michael Daly 19:20, 28 January 2008 (UTC)

What does this extension do?
I am compiling image map resources and info here:
 * commons:Commons:Image map resources

I do not understand what this extension does. How does one use it to convert an image map found on the web to one that can be used on a MediaWiki-based wiki? I figured out how to convert an image map manually, but an automated process would be very helpful. --Timeshifter 01:58, 31 August 2008 (UTC)


 * The extension installs a special page on the wiki. The special page has a text area (with a Browse button) that allows the user to input the path and file name (on the local computer) of a file containing an HTML image map.  It then takes the HTML format image map and converts it to the format required by the Imagemap extension.


 * The conversion is simple, since the HTML formats and the Imagemap formats pretty much map one-to-one. For example, the following HTML:


 * 


 * converts to:


 * poly 520 80 606 56 615 100 565 115 Prince Edward County


 * All that's done is to remove the HTML and the commas and interpret the href and title.


 * The extension can take an entire HTML page file. It will ignore everything before the first image map statement and stop after the closing image map statement (hence it will do only one image map in a file; multiple image maps in one HTML file will require the user to split the HTML file manually).


 * In processing the HTML, it will skip any nasty HTML, preventing the injection of malicious HTML.
 * --Michael Daly2 18:46, 31 August 2008 (UTC)


 * Thanks for creating this extension. Where is this special page on the Commons or on English Wikipedia? I want to try it out. Does it only work on HTML files saved on my PC? Or can I point the extension to a web page?


 * If I see an image map on a page on the web that I want to convert should I save the web page in 2 parts (the HTML file and the files folder)? Or do I save just the HTML, and then save the image separately?


 * I am a basic webmaster so I know how to separate a web page in 2 parts. But others will not be able to do that. Is there a way to tell the extension to look at the 2nd or 3rd image map on a page? --Timeshifter 01:03, 1 September 2008 (UTC)


 * Wikipedia does not use this extension. You can try it out on my wiki Kayakwiki's pool wiki.  You have to use a file, so if you want to convert a web page, you'd have to capture the page's HTML and save it as a file on your computer.  You'd have to save the image file separately and upload it to your wiki using the usual file upload page.


 * The extension only looks at the first image map on a page. You'd have to manually split it to get a second or third image map.
 * --Michael Daly2 18:00, 1 September 2008 (UTC)


 * Thanks. I tried saving several web pages with image maps to my PC. Then I browsed to them from within the converter, and clicked "submit." No luck with any of them.


 * http://flagspot.net/flags/ie(.html - The converter seemed just to copy the HTML code without converting it.


 * The only thing that showed up in the results for the rest of the pages was a pound symbol (#), and nothing else. Here are the pages that did that:
 * http://commons.wikimedia.org/wiki/Template:Clickable_map_of_Central_America
 * http://www.december.com/html/demo/imagemap.html --Timeshifter 04:13, 3 September 2008 (UTC)


 * All three work as expected for me.
 * The map of Ireland and the image map example convert just fine. The map of Central America contains an invalid "nohref" statement and gave an error message.  When I removed the offending statement, it worked fine.


 * I could see some errors have been generated in my server's PHP error logs - I think these occurred when you were testing. How did you copy the page information?  I simply selected "Save page as..." in Firefox and saved the page file as an html file, retaining the name from the web sites.
 * --Michael Daly2 16:14, 3 September 2008 (UTC)


 * I get your results when I save the pages as "HTML-only" in Firefox (though the "nohref" result was with a different page - the december.org page).


 * My previous results occurred when I saved the pages as "complete" in Firefox. I don't understand why this would matter though, since both methods save the page as .htm HTML files. --Timeshifter 03:29, 4 September 2008 (UTC)


 * I get the same results saving with "complete" or "HTML only". However, when I ran a diff check on them, there was quite a difference in things such as capitalization and such.  I can't see any difference that would account for a problem with this extension.
 * I was working from memory when I identified the nohref problem - it was probably the same page as you identify.
 * --Michael Daly2 08:01, 4 September 2008 (UTC)


 * I am using Firefox 2 instead of Firefox 3. I don't know if that matters, though. In my opinion Firefox 3 is not good for people like me with zillions of bookmarks. Lots of others are sticking with Firefox 2 also for now for various reasons.

(unindent) It would be nice to have a way to paste in the relevant HTML code directly into the conversion tool. Then people could experiment and leave lots of notes on this talk page about what works and what doesn't. I and others could add the edited notes to commons:Commons:Image map resources. --Timeshifter 09:05, 4 September 2008 (UTC)


 * That's an idea. I created this extension to make it easy for me to convert my wiki from one imagemap extension to another.  It was quick and dirty and I made it available to others.  When I used it testing this stuff, I thought that pasting the HTML would be a good idea too.


 * I have to open this thing up and fix a few things - it isn't quite up to the latest standards for Mediawiki. I may make this change while I'm at it and possibly make a few improvements as well.


 * BTW - could you send me the HTML file that caused the bugs? I could use it to find out why the program errored and fix it - even if it's a corrupt HTML file, the program should not have errored.
 * --Michael Daly2 18:18, 4 September 2008 (UTC)


 * I sent the HTML files via email. --Timeshifter 20:27, 4 September 2008 (UTC)