Extension talk:ImageMap (McNaught)

How to create map files
I want this - but how do I create the .MAP files? What is their format? Some examples would be really helpful.

Error messages
I'm getting 3 error messages on any webpage that uses

Linux support only?
Thanks for the help, but no go. It's not the filename I have wrong, it seems to be this line: $mapfile = "/var/www/html/$Mapurl"; which refers to a path that doesn't exist on my install. I wasn't looking hard enough at the error message it seems. The actual path to the .map file is

I fixed this by replacing that line with this block: if( defined( 'MW_INSTALL_PATH' ) ) { $IP = MW_INSTALL_PATH; } else { $IP = dirname( __FILE__ ); }   $mapfile = "$IP/../../$Mapurl"; which is pretty messy - I grabbed the MW_INSTALL_PATH from LocalSettings.php (I'm not a PHP programmer), but while it refers to the  directory for LocalSettings.php, it refers to the   directory for ImageMap.php - hence the

I'm sure you could fix this up to be a bit nicer.

So - all working great now. Thanks for a great extension, I'd been looking for a while for something to do exactly this. I was having issues while change the ImageMap.php with changes not appearing - turns out to be a browser refresh issue, even with Ctrl+Refresh. This is what was happening with Show Preview and the saved page having different results.

No clickability
We just installed this extension on Kayakwiki, but having some trouble getting it to work. See my attempt here. It's showing the image, but not responding to mouse clicks at all, so I guess it's not picking up the map file properly for some reason. related discussion. Any suggestions?

Is it necessary to change an apache directive to make it recognice .map files. I think it must be. Now my map file does something similar to this example fish map file when viewing directly, whereas before it showed the files contents in plain text. My .map file contents now look like this:              I tried to mimmick your example above. See anything wrong there?

-- Harry Wood 15:02, 17 July 2006 (UTC)

$mapfile variable
I implimented the fix to the mapfile path on KayakWiki and it works fine. Thanks a lot for your help.

PS - Please don't take this as negative criticism, but as constructive. I think it would be a good time to modify your extension to be more "standard". For example, most other extensions that I've installed are set up to be installed in their own directory within /extensions/. For example, /extensions/SpamBlacklist/ or /extensions/ParserFunctions/. I installed yours as /extensions/ImageMap/ and it works fine. If you do this, it keeps all the extensions separate and that makes life easier for an admin. All you have to do is change your instructions and one line of code. As well, any future changes should reflect the appropriate directory structure.

The change is require_once( "extensions/ImageMap.php" ); should be changed to reflect the subdirectory and as well, should be preceded with $IP as per other extensions. E.g. my LocalSettings.php ends with:


 * require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
 * require_once( "$IP/extensions/SpamBlacklist/SpamBlacklist.php" );
 * require_once( "$IP/extensions/ImageMap/ImageMap.php" );

Anyway, you've created a great little product and making it "standard" will endear you to all those harried wiki admins out there!

Thanks again! Michael Daly 06:07, 18 July 2006 (UTC)

Security issues
I noticed a couple serious security problems with this extension. It does no checking on the $Mapurl, so someone can use a ../../../.. path to display the contents of any file on the server. It also does no checking on the contents of the mapfile, so you can use it to bypass MediaWiki's HTML sanitizer and output any HTML (e.g., web forms, JavaScript, etc.) Use with caution. --GregU 05:33, 22 November 2006 (MST)
 * Imagemap (Alternate) provides the functionality of this imagemap extension but removes any HTML from the input file that is not specifically related to imagemap and area definition. It doesn't solve the problem of an errant URL in the file, but it eliminates malicious HTML.  Michael Daly 20:15, 16 May 2007 (UTC)

Usage from a template
Maybe a newbie question, but I didn't find the answer elsewhere... The extension works smooth for me unless I call it from a template where I pass the image and link name as a parameter like. If I do this, imagemap throws an error, saying something like "
 * you should be fine.


 * PS, it's not my extension, however, I'm familiar with it since I wrote a replacement for it to minimize the risks and allow easy conversion to the Wikipedia-standard imagemap. Michael Daly 20:51, 12 October 2007 (UTC)

Strange MySQL Error in MW 1.6.12
Database error From site_name Jump to: navigation, search A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function "". MySQL returned error "1146: Table 'wikidb16.egcur' doesn't exist (localhost)". This is for Mediawiki 1.6.12 Razool