Extension talk:ImageMap/Archive

From MediaWiki.org
Jump to navigation Jump to search


Active graphics

- you might add additional/optional columns for the onmouseover and onmouseout attributes - simply have a look at this:


- you needn't understand what the text means to figure out how probably you could use JavaScript with image maps.

- But don't be overhasty. I think perhaps one column would be enough; for example if you make a tooltip, onmouseover will call a function that displays the tooltip, and onmouseout simply calls the counterpart that hides it. It should be first discussed whether there should be elementary JavaScript functions as a part of MediaWiki... --Mr. B.B.C. 16:49, 11 January 2007 (UTC)

Change image on mouseover

I needed this functionality so I modified this extension to add it. It is a pretty nasty hack but it does the job for me. Based on [tutorial]. I modified version 1.12, will upload if anyone is interested. --Jackocleebrown 17:56, 12 March 2009 (UTC)

Does not work in Templates

Seems, the extension does not work in templates. If I write in a template:

Image:Foo.jpg|100px|picture of a foo

rect    0  0  50 50  [[{{{1|}}}]]

desc bottom-left

this is the result:

Error: Invalid title in link at line 4.

I think the extension is too early and interprets the brackets as signs instead of waiting for the replacement of the brackets with the parameter's content. If you omit the | it's even worse, then the whole page is broken. Am I right or do I make a mistake? --Slomox 17:30, 11 January 2007 (UTC)

I checked this, but I was able to use without problems in templates. jeroenvrp 02:58, 14 January 2007 (UTC)
You don't see <imagemap>: invalid title in link at line 4 in the above example? --::Slomox:: >< 16:48, 15 January 2007 (UTC)
You can use it in a template, but only without parameters. JePe 20:07, 15 January 2007 (UTC)

Actually, if you use any curly braces at all, you can't even submit or preview the page. This also rules out any magic words. – Minh Nguyễn (talk, contribs) 05:26, 17 January 2007 (UTC)

Filed as Bug 8600. --Raymond 11:29, 18 January 2007 (UTC)

If it was possible to use template parameters in this it would make replacing existing template CSS hacks much easier. 18:08, 17 January 2007 (UTC)

Just wanted to note that using {{{1}}} as part of the image name also doesn't work. Trying to develope an imagemaped element table at Wikipedia:Template talk:Elementbox header#Testing clickable elements. I'll just use a single elements name while putting together the long list of coordinates, but this needs to be fixed if it's to be usefull for this particular (and other) applications. Otherwise, this is Great, especially the auto coordinat resizing! --D0li0 04:27, 23 January 2007 (UTC)
Would love it too to see {{{1}}} template substitution for the links working -- 09:16, 1 April 2007 (UTC)
Yep, this extension doesnt work in templates with parameters. It wont accept {{{1}}} as an image link. --Kenny5 16:35, 24 December 2008 (UTC)
Use {{#tag:imagemap}} Splarka 08:11, 25 December 2008 (UTC)
Can a demonstration of this #tag parser function be demonstrated? The documentation for the tag function is significantly lacking. --Robert Horning 00:43, 19 January 2009 (UTC)
Here is an old example. Splarka 09:00, 19 January 2009 (UTC)

Does not work in Opera (round missing)

The coordinates are rendered as double values (e.g. coords="22.3404255319,22.3404255319,14.8936170213") which is useless and causes errors in some browsers. For example, in Opera all circle areas are broken. Please round all coordinates. Thank you. --TM

I checked it in Konqueror 3.5.5, Firefox and the Opera 9.1, all on Linux. I can confirm that the imagemap does not work correctly in Opera. Konqueror and Firefox work great. Anyhow I really like to thank the developer who made this possible, the possibilities are really great with this extension. jeroenvrp 03:06, 14 January 2007 (UTC)


How polygons should be described? Can you give an example? I tried to define Display and Keyboard on the example, but it does not work, probably coordinates are wrong :( Maximaximax 10:10, 16 January 2007 (UTC) PS. Polygons I created with Map This. Maximaximax 10:14, 16 January 2007 (UTC)

Look at the example. I made 2 polygons - for display and keyboard, but they are wrong - only keyboard is shown and in wrong place:

Image:Foo.jpg|200px|picture of a foo

poly 122,34 120,125 234,122 232,29 122,34 [[Display]]
poly 101,133 108,175 276,165 266,127 105,134 101,133 [[Keyboard]]

desc bottom-left

Output of this example:


What is also strange - on the original example (with circle and square) it shows only display but no keyboard:

Image:Foo.jpg|200px|picture of a foo

rect    0  0  50 50  [[Foo type A]]
# A comment, this line is ignored
circle  50 50 20     [[Foo type B]]

poly 122,34 120,125 234,122 232,29 122,34 [[Display]]
poly 101,133 108,175 276,165 266,127 105,134 101,133 [[Keyboard]]

desc bottom-left

Output of this example:


I can confirm this. jeroenvrp 12:42, 18 January 2007 (UTC)
So, can anybody help me? Explain what to do or fix the plugin? Maximaximax 07:39, 21 January 2007 (UTC)

This appears to work:

Image:Foo.jpg|picture of a foo

poly 122 34 120 125 234 122 232 29 122 34 [[Display]]
poly 101 133 108 175 276 165 266 127 105 134 101 133 [[Keyboard]]

rect    0  0  50 50  [[Foo type A]]
# A comment, this line is ignored
circle  50 50 20     [[Foo type B]]

desc bottom-left
DisplayKeyboardFoo type AFoo type Bpicture of a foo
About this image

Things to note:

  • poly coords do not take commas.
  • poly-s are defined prior to any other shapes
  • the image is left full-size

Once you get past the documentation problem involving commas, the problem is that the script is not re-initializing its list of coordinates prior to parsing poly coordinates. Thus, when parsing a poly it starts with the previous shape's coordinate list and adds the poly's coordinates to it. If you leave the image full-size, then each subsequent poly is the aggregate of all the previous poly's, but you don't generally notice because the earlier ones are on top. If you're scaling, then each subsequent poly starts with a scaled version of the previous poly, which gets kinda weird.

If you're interested in fixing it, you might insert in ImageMap_body.php right after

case 'poly':

the line

$coords = array();

Mine now looks like this (lines 140-146)

                                case 'poly':
                                        $coords = array(); /*<<<FIX*/
                                        $coord = strtok( " \t" );
                                        while ( $coord !== false ) {
                                                $coords[] = $coord;

Piped links

The documentation says that the format [[Page title|description]] should work. However, once I place that in the call to imagemap, the extension has the same issue that we've seen with curly braces: you can't submit or preview the page. – Minh Nguyễn (talk, contribs) 05:29, 17 January 2007 (UTC)

Longdesc not working

In my screen reader JAWS, when I encounter an image with a long description, I can press enter to hear the description. That doesn't work at the moment - when using the example on the page, I get this page with the extra "</wiki>" in the address. I don't see a problem with using the extension otherwise as long as sensible image descriptions are used. Graham87 07:22, 17 January 2007 (UTC)

Filed as bug 8667. Graham87 03:25, 18 January 2007 (UTC)

Image description link size

  • Would it be possible to add a way to reduce the size of the image description link? Currently existing 'clickable images' using template hacks are generally used for small icons. When the ImageMap is applied to these the link for the image description page winds up covering a large part of the image. The sister projects links on the en-wikip 'Main Page' are a good example of this. -- 15:27, 17 January 2007 (UTC)
  • Also, it would be nice if it were possible to use:


default [[Wherever]]</imagemap>
  • Currently you have to specify a rectangle, circle, or polygon region before you can set a default for the rest of the image... but 99.99% of the time people are going to want the entire image to be clickable and link to a single location. -- 15:34, 17 January 2007 (UTC)
filed as Bug 8603. --Raymond 11:27, 18 January 2007 (UTC)
Quick hack for the default is:
Image:Foo.jpg|200px|picture of a foo
circle 0 0 0 [[0]]
default [[Display]]
desc bottom-left

AzaToth 22:32, 11 March 2007 (UTC)

  • The above worked fine for me in Firefox but in I.E. 7.0 the hyperlink does not work (you can't click through to the page specified). Ross Allen 20:12, 21 May 2008 (UTC)
  • Another issue, if 'imagemap' is used within a template it does not seem to be able to handle parameters. That is, <imagemap>Image:{{{image|smiley.jpg}}}, fails to display any image at all even if the 'image' parameter is set. -- 17:34, 17 January 2007 (UTC)
    • See #Broken? above, this has already been reported and filed in Bugzilla. The wub 16:18, 22 January 2007 (UTC)

Responding to your first question, you can disable the image description icon entirely by specifying desc none at the end of the call to <imagemap>. – Minh Nguyễn (talk, contribs) 19:29, 17 January 2007 (UTC)

  • i Info button on the image

After I installed the imagemap extension, when I was first trying to use it, an kind of ugly 'i' info button showed up on top of the image. It took a while to figure out how to get rid of this 'i' since the syntax example provided in the extension is incorrect (I think). At the bottom of the syntax example it reads:

desc bottom-left


However, in the image example, there is no 'i' button in the lower lefthand corner of the image. If I understand this extension correctly, either the syntax example should be changed to

desc none


or the example should correctly reflect the syntax example, and show the 'i' button in the lower lefthand corner.

Inline use

First of all, thanks to TimStarling for this fantastic and long-awaited extension! It is really handy. However, there is one (minor) problem with it: It can't be used inline. If I want a line that links a country's flag to the country (instead of the image, of course), then write something next to the flag, that text will come one liner further down. See what I mean here:

The possibility to use it in templates would also be handy. Otherwise it is excellent. Thanks for making it! Jon Harald Søby 20:16, 18 January 2007 (UTC)

Try floating the image:

It's not very flexible, but it works for displaying flags next to countries' names.

 – Minh Nguyễn (talk, contribs) 20:01, 20 January 2007 (UTC)

Inline use is possible with this extension. It is explained in the German Wikipedia: see here and here. --WIKImaniac 13:09, 3 August 2007 (UTC)
If Bugzilla:8788 and Bugzilla:8718 are fixed, then this should be cleared up without the German Wikipedia approach. In the meanwhile, that display:inline approach looks pretty good. Michael Daly 21:26, 5 August 2007 (UTC)

Get no link

Can anyone explain why this doesn't work? I am trying to link the big logo image in the center to a page. But using <imagemap> it winds up with no link at all, neither to the page nor to the imagepage.

I've probably made some silly mistake in the coding, but if someone could point that out it would also be great. Dovi 06:41, 19 January 2007 (UTC)

First of all, a 50×50-pixel rectangle wouldn't cover very much of the 180×190-pixel image. But besides that, I've noticed that this extension tends to reduce the shape sizes to between ½ and 1/3 of the specified sizes. In the case of this image, it means that the linked region is a 22×22-pixel rectangle in the very top-left corner, in whitespace. If you make the rectangle 400×500 px, or turn it into a circle using:
circle 205 215 205 [[Wikisource]]
it seems to work fine.
 – Minh Nguyễn (talk, contribs) 19:56, 20 January 2007 (UTC)
Thanks very much! Dovi 06:09, 21 January 2007 (UTC)

default = image

It would be nice if the simple default for coordinates was that clicking anywhere on the entire image (with the exception of the image description link if there is one) sends the user to the link. I.e. with no coordinate numbers, to make it easier for the average user -- mainly when the user simply wants the image to serve as an icon. Is this currently possible? Dovi 11:54, 21 January 2007 (UTC)

External linking

Would it be possible for this extension to support linking to external sites? Somethign like: -

 Image:Firefox.jpg|200px|picture of Firefox
 default  http://www.firefox.com
 desc none

Thanks, Cocjh1 18:49, 21 January 2007 (UTC)

I was also looking for this function. Is it coming soon? Otherwise, thanks for good work!

Hi. Thanks for your work. I was also looking for this function. Is there a workaround in the mean time?. I am on MW 1.11. Thanks - JdV 19.06.2008

It's possible since a while:
 Image:Firefox.jpg|200px|picture of Firefox
 default  [http://www.firefox.com]
picture of Firefox
About this image


This doesn't seem to work with anchor links either e.g.

Image:Foo.jpg|100px|picture of a foo
rect    0  0  50 50  [[#Polygons]]
desc bottom-left


#Polygonspicture of a foo
About this image

with a link to[[]]rather than #Polygons. the wub "?!" 16:25, 22 January 2007 (UTC)

Noticed this is bug 8917. the wub "?!" 18:52, 1 March 2007 (UTC)

Dutch Translation

I don't know were or how to post it so I put it here, you are free to movie to another more appropiate location:

I have made a Dutch translation for the ImageMap extension which could be incorporated in a later version:

 /* Dutch (Erik van Berkum) */
 'nl' => array(
 'imagemap_no_image'             => '<imagemap>: moet een afbeelding specificeren in de eerste  regel',
 'imagemap_invalid_image'        => '<imagemap>: afbeelding bestaat niet of er is een spelfout',
 'imagemap_no_link'              => '<imagemap>: ongeldige link gevonden aan het eind van de regel $1',
 'imagemap_invalid_title'        => '<imagemap>: ongeldige titel in de link bij regel $1',
 'imagemap_missing_coord'        => '<imagemap>: niet genoeg coordinaten voor een vorm bij regel $1',
 'imagemap_unrecognised_shape'   => '<imagemap>: de vorm wordt niet herkent bij regel $1, elke lijn moet starten met een van de volgende: '.
								   'default, rechthoek, circel or poly',
 'imagemap_no_areas'             => '<imagemap>: op zijn minst een gebied moet gespecificeerd worden',
 'imagemap_invalid_coord'        => '<imagemap>: ongeldige coordinaat bij regel $1, het moet een nummer zijn',
 'imagemap_invalid_desc'         => '<imagemap>: ongeldige desc specificatie, moet een van de volgende zijn: $1',
 'imagemap_description'          => 'Over deze afbeelding',
 # Note to translators: keep the same order
 'imagemap_desc_types'           => 'boven-rechts, beneden-rechts, bodem-links, boven-links, geen',

Possible bug report

I've discovered why some of the click maps seem to be far too small: The pixel co-ordinates specified are for the original-sized image, not for the image as resized by this tag. Since this tag is itself resizing images, and since the image map coordinates come after the resize statement, shouldn't the co-ordinates refer to the transformed pixels rather than the original ones? 18:09, 23 January 2007 (UTC) Rawling from Wikipedia

Well, I've noticed this is explicitly referenced on the main page, so I'll just leave now. Hopefully this might explain it if, like me, someone else fails to notice... 18:36, 23 January 2007 (UTC) Rawling from Wikipedia

Bug 8835: No links from image caption

Filed as 8835:

Try this from within Wikipedia (the links from the image won't lead anywhere in MediaWiki):

The EarthDysnomia(136199) ErisCharon(134340) Pluto(136472) 2005 FY9(136108) 2003 EL61(90377) Sedna(90482) Orcus(50000) Quaoar(20000) Varuna
The largest Trans-Neptunian objects that prompted the IAU's decision.

Urhixidur 20:40, 30 January 2007 (UTC)

Installation Instructions

I have copied these files into extensions/ImageMap and added the necessary line to LocalSettings.php, however the example produces no image and no error messages.

Could someone provide a list of the steps necessary to enable this extension.

Many Thanks RGuest 22:44, 4 February 2007 (UTC)

Done. --GunterS 14:24, 10 February 2007 (UTC)

Another imagemap variant

I've developed an ImageMap extension at the same time and published documentation before this was published. In my opinion I was ready before all of this was posted. This seems to be an accident or a mistake. I do not like to work at something another guy already coded. I searched all extension sources and MediaWiki and I've not found an imagemap extension at the end of January 2007. Than I started to write an extension at my own. The major benefit of my work compared to this imagemap extension is that using my extension a user can use kImageMapEditor to create imagemaps. This is just a huge benefit compared to this extension.


There is also Shannon McNaught's version that is older than yours or Tim's.
I'm currently writing a php program to convert a generic HTML file with <MAP>...</MAP> included into the map tag format that Tim's ImageMap extension uses. I have a bunch of wiki articles that use the older ImageMap format with files and this will allow me to convert them. As well, it will allow me to convert files generated by generic Map editors for use with Tim's ImageMap.
I was also thinking of taking the two ImageMap extensions and merging them into a single extension so that one can use either format - external files with map data uploaded to the wiki (McNaught's)or imbedded map tags (Tim's). I wonder if there'd be any interest? Michael Daly 19:24, 25 March 2007 (UTC)
I've done this as Extension:ImageMap (Alternate). Michael Daly 05:51, 5 May 2007 (UTC)

No image found: more information

I added the name of the image to the error message. Makes it easier to find the missing image.

// ImageMap_body.php
		$domDoc = DOMDocument::loadXML( $imageHTML );
				$xpath = new DOMXPath( $domDoc );
				$imgs = $xpath->query( '//img' );
				if ( !$imgs->length ) {
					return self::error( 'imagemap_invalid_image' . ': ' . $image ); // change this line
This fix will break the internationalization. The text 'imagemap_invalid_image' is the key to a table that contains the full text of the message in the user's language. There is a better way to do this but it requires a change to the error messages. Michael Daly 07:09, 12 May 2007 (UTC)

MediaWiki 1.8.2

I found that it works in 1.8.2 also.

I get "Table 'wikidb.mw_cur' doesn't exist (localhost)" in MediaWiki 1.8.2 -- Adrianm, 28 February 2007
the cur table hasn't been used since the days of 1.4 - i find it unlikely this extension is using it (in fact, it does not appear to use any direct db access at all). So that error must be caused by something else. -- Duesentrieb 10:26, 28 February 2007 (UTC)
thanks, I now get: "Class 'DOMDocument' not found", even though this class should be included in PHP 5 [1] (I am using PHP 5.1.6) -- Adrianm, 2 March 2007

Eliminate Case Sensitive Shape Names

I added a couple of lines to ImageMap_body.php:

# Handle desc spec
$cmd = strtok( $line, " \t" );
# ignore case
$cmd = strtolower( $cmd ) ;

and here:

# Tokenize shape spec
$shape = strtok( $shapeSpec, " \t" );
# ignore case
$shape = strtolower( $shape ) ;

to eliminate case sensitivity in the shape parameters - this to make it easier to convert from Shannon McNaught's older version of ImageMap to this one.

Thanks for the extension!
Michael Daly 21:46, 7 March 2007 (UTC)

Fallback for mobile phones etc?

Just wondering how the image maps behave on less capable browsers like mobile phones etc. I'm a bit concerned that lists of links on Wikipedia are being replaced by image maps, without regard for browsers that can't render them (or in which clicking on a link in an image is basically impossible). If this is a valid concern, we might need a policy like "Every image map should be accompanied by a link to an equivalent list of the links"? Stevage 13:26, 11 March 2007 (UTC)

Single Area / clickable image

It would be nice if you could make clickable images easily by just giving the default area. Now you have to specify also a dummy rect area. And the default does not seem to work (bug?)

picture of a fooFoo type A
About this image

Can do!

I believe that we could enable clickable images simply by removing the test that requires at least one area to be defined. Ie. in ImageMap_body.php, remove these lines starting about line 190:

if ( $output ==  ) {
    return self::error( 'imagemap_no_areas' );

This works for me, at least on MW 1.9.3:

Image:MyImage.jpg|200px|picture of a foo
default [[Foo type B]]
desc none

I think this would be useful, and I can't see any harm. JohanTheGhost 19:49, 4 April 2007 (UTC)

This is in the latest release of ImageMap. BTW - the above patch is not "safe" as it prevents a check on no imput at all! The fixed version has a safer check. Michael Daly 05:54, 5 May 2007 (UTC)

Extension extension

Hi Tim. Great extension!

I have a question:

Is it possible for a mapped area to trigger "Lupin's popups" like the unmapped area does? Or is that a question for Lupin?

And 2 really cool additions that should excite and intrigue you :->

1) add a color-key (or similar) to individual areas. (Ambitiously with a "legend".)
2) add an optional "detail" field to ImageMap such that a sub map will be displayed. E.g. for a detailed "ImageMap:Countries of the world allow a grab of (x1,y1, x2,y2) to display just an ImageMap-ed detail of central Africa. (Even if the sub-map has to be created as a seperate image, allows the use of the larger ImageMap coords.)

Think of the possibilities! A single, really detailed map of the world/motherboard/whatever that can/would be populated as needed and grabbed willy-nilly the next time someone needs a submap. Now, a sub-map has to be re-ImageMap-ed all over again.

Don't those sound like fun???? --Saintrain 02:40, 2 April 2007 (UTC)

Other formats than JPEG?

I noticed that png-images are not working as image-source. Could this be changed?

This extension works just fine with png, gif and jpg. Perhaps your problem is that your installation does not premit png. In DefaultSettings.php, you have the valid uploadable file extensions with
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg');
If png isn't in there, copy the line into LocalSettings.php and change it to include png. Michael Daly 16:25, 13 May 2007 (UTC)

Enhance extension/fix bug

Linking to internal page works fine:

rect x1 y1 x2 y2 [[internalPage]]

But linking to section within internal page does not work. Instead of arriving to someSection you arrive to the top of the internalPage:

rect x1 y1 x2 y2 [[internalPage#someSection]]

Code fix

Look in Imagemap_body.php and find a line of code that looks like:

$attribs['href']   = $title->escapeLocalURL();

and change it to add the following end.:

$attribs['href']   = $title->escapeLocalURL() . $title->getFragmentForURL();

I've updated my version (Extension:ImageMap (Alternate)) with the same fix. Michael Daly 10:19, 18 April 2007 (UTC)

This fix is in the latest version of ImageMap Michael Daly 05:56, 5 May 2007 (UTC)

Fixed with rev:21299. --Raymond 08:12, 10 May 2007 (UTC)

Php Error

Right now the code works, but produces the following PHP error: [Wed Apr 18 16:03:03 2007] [error] [client] PHP Notice: Undefined variable: extLinks in /x/eng/wiki/xwikid/extensions/ImageMap/ImageMap_body.php on line 292 [Wed Apr 18 16:03:03 2007] [error] [client] PHP Warning: Invalid argument supplied for foreach() in /x/eng/wiki/xwikid/extensions/ImageMap/ImageMap_body.php on line 292

Fixed with rev:21360. --Raymond 08:11, 10 May 2007 (UTC)

Special chars in external url

It seem extension done incorrectly when there are some special characters in external url. For example:

rect 0 0 50 50 [http://en.wikipedia.org/w/index.php?title=Main_Page&action=edit]
desc none

The link will be http://en.wikipedia.org/w/index.php?title=Main_Page&amp;action=edit.

To correct this problem, just remove htmlspecialchars() for $title in case of external linking.

--- ImageMap_body.php   (revision 22019)
+++ ImageMap_body.php   (working copy)
@@ -129,11 +129,11 @@
                                $alt = $title->getFullText();
                        } elseif ( $wgImageMapAllowExternalLinks && ( in_array( substr( $link , 1 , strpos($link, '//' )+1 ) , $wgUrlProtocols ) || in_array( substr( $link , 1 , strpos($link, ':' ) ) , $wgUrlProtocols ) ) ) {
                                if ( preg_match( '/^ \[  ([^\s]*+)  \s  ([^\]]*+)  \] \w* $ /x', $link, $m ) ) {
-                                       $title = htmlspecialchars( $m[1] );
+                                       $title = $m[1];
                                        $alt = htmlspecialchars( trim( $m[2] ) );
                                        $externLink = true;
                                } elseif ( preg_match( '/^ \[  ([^\]]*+) \] \w* $ /x', $link, $m ) ) {
-                                       $title = htmlspecialchars( $m[1] );
+                                       $title = $m[1];
                                        $alt = htmlspecialchars( trim( $m[1] ) );
                                        $externLink = true;
Please open a new bug at http://bugzilla.wikimedia.org and attach your patch. Thanks. --Raymond 08:10, 10 May 2007 (UTC)

Possible Bug ?

I get the next bug : Warning: call_user_func_array(): First argumented is expected to be a valid callback, 'ImageMap::render' was given in includes/Parser.php on line 468

The code is:

Imagen:My_Image.png | 200px | This image ...

rect    0  0  50 50  [[Foo type A]]
circle  50 50 20     [[Foo type B]]
desc bottom-left

And nothing is displayed, anyone could help me? Thanks !

I encountered this same error when trying ImageMap with an older version of MediaWiki. Upgrading to 1.12 solved the problem.

please support external links in the new version

Current version is only supporting internal links. Please support external links, too. --Yes0song 13:26, 14 June 2007 (UTC)

External links are already supported, but you have to enable them with "$wgImageMapAllowExternalLinks = true;".
See Extension:ImageMap#Parameters
Oh, "NOTE: This parameter has been removed in the latest version (Revision 23292). It now always permits external links." is wrote on Extension:ImageMap#Parameters. I think the extension should re-support external links and hope that the Wikimedia Foundation will set the parameter "true" on all the Wikis hosted by the foundation. --Yes0song 08:29, 13 July 2007 (UTC)
This is not an issue with the extension - it is an issue with Wikipedia. You can make the request to enable external links on Wikipedia via Mediawiki Bugzilla. Michael Daly 17:35, 14 July 2007 (UTC)
I misread "now" in "It now always permits..." as "not". --Yes0song 04:20, 15 July 2007 (UTC)

Integration in default mediawiki distribution

Couldn't it be possible to implement this (very useful) function natively into mediawiki? It doesn't have to be exactly in this form, but I can think of something like:


...therefore simply allowing [[image]] inside a usual link would also be an intuitive way for authors to include images within links.


Fatal error: Call to undefined method Title::getFragmentForURL() in /extensions/ImageMap/ImageMap_body.php on line 199

what's the problem?

What version of Mediawiki are you running? Michael Daly 17:37, 23 June 2007 (UTC)
I'm having the same problem. Using fully patched Ubuntu server (mediawiki 1.7) with no other extensions, and subversion rev 23292130.102.0.178 06:39, 28 June 2007 (UTC)
Read the description again, particularly the part where it says that this extension works with MediaWiki version 1.9 and later. HTH HAND —Phil | Talk 07:20, 28 June 2007 (UTC)

I was just about to correct myself. Thanks 07:39, 28 June 2007 (UTC)

Port to Mediawiki 1.7


I was unable to find any information on porting this extension to mediawiki 1.7 here or anywhere else.

I was however able to do this myself. The two necessary changes are outlined below. Hopefully they will be useful to someone. Only two changes are necessary to the file ImageMap_body.php

1. Change call $title->getFragmentForURL() to $title->getFragment() (line 199)
2. Change call $parser->mOutput->addLink( $title ); to $parser->mOutput->addLink( $title, null ); (line 295)

Hope this helps!

-- 15:21, 11 July 2007 (UTC)

Addition request: blue info icon only for logged in users

Hey this is sort of a request, would there be a way to make this extension only show the blue icons for users that are logged in? I'm using this extension to make images linkable to articles, and the wiki it's self is being used as a website/CMS. by hiding the links from guests that would allow the admins an easier time maintaining the image without having to go to image list, and keep the site clean for normal users. I tried to do this on my own but I didn't get it to work. Thanks. 00:24, 19 August 2007 (UTC)
Not tested, but in ImageMap_body.php (around line 103) try:
# Handle desc spec                                                               //look for this comment
$cmd = strtok( $line, " \t" );
if ( $cmd == 'desc' ) {
  if( $wgUser->isLoggedIn() ) {                                                  // add this line
    $typesText = wfMsgForContent( 'imagemap_desc_types' );
    if ( $descTypesCanonical != $typesText ) {
      // i18n desc types exists
      $typesText = $descTypesCanonical . ', ' . $typesText;
    $types = array_map( 'trim', explode( ',', $typesText ) );
    $type = trim( strtok( '' ) );
    $descType = array_search( $type, $types );
    if ( $descType > 4 ) {
      // A localized descType is used. Subtract 5 to reach the canonical desc type.
      $descType = $descType - 5;
    if ( $descType === false || $descType < 0 ) { // <0? In theory never, but paranoia...
      return self::error( 'imagemap_invalid_desc', $typesText );
  } else {                                                                        // add this line
    $descType = self::NONE;                                                       //  up 
  }                                                                               // to this line

No promises, but it looks reasonable. Michael Daly 19:54, 22 August 2007 (UTC)

"default none" would be useful

I would like to have an image that does not have any target link - purely acting as an icon. However, the extension complains when there are no links. -- Barrylb 02:01, 20 August 2007 (UTC)

Why would you use imagemap at all in that circumstance? If you don't want a link, just display the image alone. Or do you mean that you want to use it as a means of turning off the link to the image page itself? Michael Daly 19:16, 22 August 2007 (UTC)
Yes, I would like to use it to turn off the link to the image page. Seems like a useful thing to do with extension. Barrylb 04:54, 23 August 2007 (UTC)
I'd expect some resistance to allowing that in this extension, since it's used in Wikipedia and they won't want to turn off the link to the attribution and copyright info for the image. You could try putting in a request via Mediazilla and see what happens. I could see making it a site-configurable option - i.e. the wiki's admin can allow or disallow the use of such an option. Michael Daly 05:00, 28 August 2007 (UTC)
Though the blue icon is still there, and I don't know how to get rid of it, you should be able to just use it like this. — Preceding unsigned comment added by (talkcontribs)
desc none does the trick :-) --Raymond 06:13, 29 August 2007 (UTC)
Displaypicture of a foo
Image:Foo.svg|200px|picture of a foo
poly 0 0 0 0 [[Display]]
desc none

Error on install

When I attempt to install this extension, I get the error below displayed when I attempt to view the main page of my wiki. Restoring the original localsettings.php file removes the problem. Any suggestions on how to fix this? Peter Campbell 00:16, 19 September 2007 (UTC)

[mediawiki] / trunk / extensions / ImageMap / ImageMap.php 	Repository: mediawikipywikipedia
ViewVC logotype

Log of /trunk/extensions/ImageMap/ImageMap.php

Parent Directory Parent Directory
Links to HEAD: 	(view) (download) (as text) (annotate)
Sticky Revision: 	
Revision 23533 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 29 01:36:09 2007 UTC (2 months, 3 weeks ago) by simetrical
File length: 516 byte(s)
Diff to previous 23292

Extensions too!

Revision 23292 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jun 23 11:01:10 2007 UTC (2 months, 3 weeks ago) by tstarling
File length: 518 byte(s)
Diff to previous 21360

Removed $wgImageMapAllowExternalLinks, feature enabled unconditionally. Not sure why you wouldn't want that.

Revision 21360 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Apr 19 06:00:19 2007 UTC (5 months ago) by raymond
File length: 657 byte(s)
Diff to previous 21342

* Changing $wgImageMapAllowExternLink -> $wgImageMapAllowExternalLinks
  per hint of Rob Church at wikitech-l
* ooops, not every ImageMap use external links...

Revision 21342 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Apr 18 09:14:41 2007 UTC (5 months ago) by raymond
File length: 654 byte(s)
Diff to previous 19113

* (bug 8746) Support for external links
  $wgImageMapAllowExternLink = false per default -> no risk for WMF live sites

Revision 19113 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jan 11 05:36:48 2007 UTC (8 months, 1 week ago) by ivanlanin
File length: 518 byte(s)
Diff to previous 17337

Add descriptions and urls (if available) for 4 extensions used in Wikipedia:
* ConfirmEdit
* EasyTimeline
* ImageMap
* OAIRepository

Revision 17337 - (view) (download) (as text) (annotate) - [select for diffs]
Added Wed Nov 1 06:34:42 2006 UTC (10 months, 2 weeks ago) by tstarling
File length: 356 byte(s)

HTML image map extension. Not quite complete, but usable as it is.
What part of that is an error? It looks like a dump of the SVN info.
Did you download the files properly? I've seen something like this when someone thought they were downloading the file, but ended up saving the display of the SVN page instead. When included into the LocalSettings.php file, it just spewed out onto the main page.
Look at the files you've downloaded with a simple editor and compare the content with the (view) of the same file from SVN. If they don't match, you've not got the proper PHP source. Michael Daly 15:49, 22 September 2007 (UTC)
I downloaded all the files again for the extension and this fixed the problem. Thanks for your help Peter Campbell 22:48, 24 September 2007 (UTC)

Default link doesn't work

Clicking on an area with no link defined does not work in IE6 (will test Firefox later). Ironically, right-clicking and selecting 'open link in new window' does work. Also, the default link does work when no other areas are defined. Edokter 10:36, 2 October 2007 (UTC)

With circe:

Start now!Project:Help
About this image

Without circle:

Start now!
About this image

Anchors on same page (create error on specialpage "wanted pages")

If I use an anchorlink in an imagemap that links directly to the same page (e.g. #foo) I get an errormessage on "wanted pages":

Fatal error: Call to a member function getPrefixedUrl() on a non-object in /var/www/xyz/html/wiki/includes/SpecialWantedpages.php on line 105

This can be avoided by typing the full pagename in front of the anchorlink (pagename#foo). 17:53, 6 October 2007 (UTC)

Alt info?

How about adding Alt descriptions for those visually impaired folks who have to use special tools to get around the web? Is it implemented already? Because it is not demonstrated on the extension's page, and Dreamweaver keeps yelling at me to fill it :-) --Nathanael Bar-Aur L. 00:30, 23 November 2007 (UTC)

Check the page output source in your browser. You should see the alt filled in. If you look at the image properties (in Firefox at least) you'll see the alt filled out. Alt is filled with the text that follows the pipe in:
image:foo.jpg|this is alt text

--Michael Daly 07:11, 23 November 2007 (UTC)

I know, I meant to the setting of the Alt for each clickable area (poly, circle etc).
This is the html code Dreamweaver puts out:
<map name="Map" id="Map">
<area shape="rect" coords="71,17,101,43" href="http://www.somesite.com" alt="OPTION ONE" />
<area shape="circle" coords="64,80,10" href="http://www.someothersite.com" alt="OPTION TWO" />
I guess the program reads them out aloud one by one, so that the person can make a selection. Thanks, --Nathanael Bar-Aur L. 21:04, 25 November 2007 (UTC)

Blank page when called. (RESOLVED)

I'm not sure whats going on but when image map is enabled and an image map is put into the page the screen blanks on both preview and saved view. Running FC5, Apache 2.0, php5 fresh install of MW 1.11. I thought installing Wiki for a testing ground was going to be an easy install but I guess I was wrong. I'm bumping into all kinds of problems. --DP67 (talk/contribs) 04:02, 28 December 2007 (UTC)

Enable PHP error logging and see what error(s) is occurring. A blank page is usually a PHP error. --Michael Daly 01:25, 29 December 2007 (UTC)

Thanks Michael, Its fixed. It was php error. php-xml was not installed. I installed it and it worked.

DP67 (talk/contribs) 05:22, 29 December 2007 (UTC)

commons images?

I noticed a problem when attempting to use an image from a commons-style repository:

uncyclopedia:fi:Malline:Lahjoitukset was showing "invalid or missing image" when the image itself (uncyclopedia:fi:common:image:Donation_button_fi.png) was in a shared repository.

Once I download the image and upload it to that local wiki (uncyclopedia:fi:Kuva:Donation_button_fi.png) the problems go away.

Is this a bug, or just a case of trying to get the extension to do something it wasn't designed to do? -- 04:35, 1 January 2008 (UTC)

To my knowledge, uncyclopedia does not use the commons repository. Mønobi 06:05, 1 January 2008 (UTC)
The version for Finland uses a commons repository, just not "the" commons repository used by Wikimedia. -- 23:30, 21 February 2008 (UTC)

Bug in RTL mediawikis?

For some reason it adds a redundant horizontal scrollbar to the page on IE 7. See http://www.astropedia.co.il

Thanks, --Nathanael Bar-Aur L. 18:41, 16 January 2008 (UTC)

Comparing the IE7 and Firefox views of the page, I think the problem is in the CSS for the page rather than directly due to the imagemap extension (though imagemap may be exacerbating the existing problem). That's an educated guess rather than anything else, but I noticed that resizing the font (<ctrl><+> or <ctrl><->) works fine in FF but is messed up in IE7. In FF, the sidebar on the right is sized according to the font and the content area moves slightly to accommodate. IE7, on the other hand, either has the content area overlapping the sidebar or moves the content far to the left.
IE is picky about sizing of various objects on the page (especially <div>s, <table> cells etc.) and this sort of thing might, with other sizing problems, be pushing the overall page width to be slightly larger than the viewable width and IE then pops in the horizontal scroll.
I'd suggest looking into IE7fixes.css and see if there need to be adjustments for the skin. I have no experience with RTL fonts, so there may be a simple problem to fix to tell IE what's going on. It's surprising to me, since it appears you're using generic Monobook. --Michael Daly 19:47, 17 January 2008 (UTC)
Funny thing is that there is no content overflowing. It seems as if it might be some shadow margin or something of that sort. I looked at the file, but all these CSS hacks are chinese to me. Is there a place I can go to ask about IE fixes for MediaWiki's Monobook skin? Thanks, Nathanael Bar-Aur L. 14:16, 23 January 2008 (UTC)

Where are images stored?

I can search a site and figure out where a specific image is stored but I looked through the code and couldn't tell how the code determined where to put the image. I'm writing a Perl script to crawl a Wiki (we've got MediaWiki at work and I have a couple of MW wikis at home) and generate a set of web pages. I can do regular images with no problem but I want the code to be able to know, deterministically, where ImageMap images are kept.

Thanks! Code Monkey 00:36, 8 February 2008 (UTC)

Never mind -- I figured it out. The burden of being an idiot is, sometimes, nearly too much to bear.

Useful suggestion: Add a class

For the CSS, this extension could be more easy inserting the 'class="imagemap"' to the link which wraps the image, as the default [[image:]] does (it inserts class="image"). --Sergio 01:17, 18 February 2008 (UTC)

Display 2 imagemaps inline

Hi! i'm struggling with this problem, you can see better here:

DisplayKeyboardFoo type AFoo type Bpicture of a foo
About this image
DisplayKeyboardFoo type AFoo type Bpicture of a foo
About this image

it's possible to put 2 or more imagemaps in line? if yes, how? ( i prefer to not use a table. )

Thanks, Arlas!! , 15:55 23 feb 2008

You can use table:
DisplayKeyboardFoo type AFoo type Bpicture of a foo
About this image
DisplayKeyboardFoo type AFoo type Bpicture of a foo
About this image
| <imagemap>...</imagemap>
| <imagemap>...</imagemap>
~ putnik 11:21, 24 February 2008 (UTC)

I know that i can use a table, i wrote that i prefer to not use it ;) maybe someone can add a code in imagemap to make it stay in the same line. I hate tables! ( and notice that they go in the next line, they cannot stay in the same line of the text )

text1 ->

text2 ->
picture of a foo
About this image
picture of a foo
About this image
<- text2

<- text

This is not good, ex: i want to put two small imagemaps in text like "... text O text O text ..." Arlas!! 13:44, 2 mar 2008

Imagemap can't currently do this, as it wraps the image in a <div> of unspecified width. This causes other problems. There's a bug report on it. A fix has been proposed and code for the fix submitted (by yours truly in mid 2007) but it has not been reviewed and acted on.
In the meanwhile, your only alternative is a table or to wrap the imagemap in a <div> of fixed width. --Michael Daly 17:11, 15 March 2008 (UTC)
I've had no problems doing this with a fixed-width wrapper and CSS Float. Works like a charm. Arodicus
Has there been any resolution to this bug? I haven't been able to get this to work in any reasonable way unless it's on its own line. Then I can float the imagemap or the text, but even with everything or just the imagemap within a fixed-width div, it won't stay on the same line as other text. - 23:17, 13 January 2009 (UTC)
This was supposedly fixed recently. I haven't updated to the recent version so I can't test it right now. --Michael Daly2 03:58, 14 January 2009 (UTC)


Fatal error: Call to undefined function wfloadextensionmessages() in /home/a5668505/public_html/wiki/mediawiki-1.9.3/extensions/ImageMap/ImageMap_body.php on line 31

???-- 22:42, 21 March 2008 (UTC)

Function wfLoadExtensionMessages() was added in MediaWiki version 1.11. Upgrade your wiki (recommended) or use an older version of ImageMap extension (it can be found in the SVN). --Sayuri 22:46, 21 March 2008 (UTC)

I have 1.9.3, so that cant be it.-- 03:12, 22 March 2008 (UTC)
You have to use compatible versions. Either the latest Imagemap version with MW1.11 or an older Imagemap version with 1.9.3. --Michael Daly 19:16, 23 March 2008 (UTC)


Image map on top of equations script?:

would be sweat - you could hover over formulas to reveal the descrition and then click on it to go to an appropriate page. 21:19, 12 May 2008 (UTC)

Imagemap with the Imagemap Template from Wikipedia

Hello, I tried to use the Wikipedia-Template Template:Imagemap, but nothing happened. I want to use it in an other Template with some Coords, but it doesnt works. The output is just:
<div style="position:absolute; z-index:2; top:66.8%; left:34.1%; height:0; width:0;"> {{#tag:imagemap|Bild:RedMountain.svg|12x12px|Otzberg default Otzberg desc none}} ">Otzberg </div></div> Can you help me??

<div style="position: relative">

What purpose does the extra div serve apart from to restrict the possibility of using this for inline images? Is it possible to get a class-name added to the div instead of just manually coding in the style, both to be neater and also to allow for customisation? Conrad.Irwin 19:26, 7 June 2008 (UTC)

Add usual wiki picture border to imagemap pictures

I removed this from the feature requests, since it is already there. Imagemap can take all the parameters of an image. For example,

image:example.jpg|frame|center|300px|Bunch of text

will produce a frame around the image, the image will be centered on the page and 300px wide with the text as a caption. --Michael Daly2 04:59, 6 July 2008 (UTC)


This command doesn't work in a page where {{SUBPAGENAME}}=1 (at template namespace):

default [[w:]]</imagemap>



works normally, and create 1.svg and w:. Try it in the special:ExpandTemplates. Why is this happening? Heldergeovane 01:50, 19 July 2008 (UTC)

Use with Extension:TagParser. For example,
default [[w:]]
desc none
--Fryed-peach 10:36, 23 July 2008 (UTC)

Policy discussion at en.wikipedia

There's currently a discussion at en:Wikipedia talk:Image use policy#Image maps about image maps and their policy implications. If developers and other users interested in this extension want to comment there, that would be very helpful. Chick Bowen 02:20, 7 September 2008 (UTC)

Using Media Links

Is it possible to use Media: links with this extension? It seems that these links aren't working properly; instead of linking Media:Example.png to the actual file, it links to a wiki page (which then redirects to the Image: page).
--Ryan lane 14:58, 20 November 2008 (UTC)

Give it a try with Special:Filepath:
rect 0 0 135 135 [[Special:Filepath/Wiki.png]]
desc none
Splarka 08:29, 21 November 2008 (UTC)
Looks like this works perfectly; thanks!
--Ryan lane 14:42, 21 November 2008 (UTC)

Javascript as part of Imagemap


thanks for this nice extension. i have a map with some javascript elements, like

onMouseover="ddrivetip('<img src=\'images/image.jpg\' />')"; onMouseout="hideddrivetip()" />

the JS is for popping up some other image on mouseover. How can I make this possible?

is there any other way for this?


Creating a image dictionary

I believe that the imagemap extension could be nice to create a collaborative image dictionary like http://www.bildwoerterbuch.com (but better). We have enought pictures an interwikilinks to create such a thing where poeple have a way to learn languages. It would be a project between Commons, Wikipedia, Wiktionary and Wikiversity. I would see the meta files in the image description page at Commons and a translation tool at toolserver where the user could choose one or two languages. We would need a complete Interwikilink database and a tool like this from dapete to create such content. And it would be nice to see directly the vocabulary at screen, but this should be no problem for the script with the help of CCS, see commons:Commons:Geocoding/Panorama. What do think about it? Interested? Where is a better place to discuse? --Kolossos 10:13, 21 January 2009 (UTC)

Imagemap and external images


Is there any way to use imagemap with external pictures ? Like


rect 75 91 220 178 Internal wiki linnk

desc bottom-left

test example makes little sense, moved to talk

Test installation:

  1. Download Image:Foo.jpg and upload it to your wiki.
  2. Make a new Article ImageMap and copy & paste the text of this article (at least section "syntax example") to your article

Odessaukrain 00:45, 31 May 2009 (UTC)


Why does this layout keep giving me the errors

Error: at least one area specification must be given</br></br> <nowiki><imagemap>Image:Google wordmark.svg|120px|alt=Alt text default [[Google]] desc none

Note:I was trying to make an image link without captions, border...etc.

--Michael Daly2 19:03, 31 May 2009 (UTC)

Make sure the items are on separate lines:
Image:Google wordmark.svg|120px|alt=Alt text
default Google
desc none
--Michael Daly2 19:03, 31 May 2009 (UTC)

Text labels in image

Hi. I recently stumbled over an IMHO very ugly hack for creating image maps with text lables. For example one template using this hack is en:Template:Star_nav (and its translations in other Wikipedias). How about adding directly visible text labels (both: links and plain text) to the imagemap extension? It would very helpful as we could avoid a lot of multiple translated versions of diagrams (if you look at Wikimedia Commons you will find a lot of localised versions of diagrams) and of course yet another ugly hack could be avoided. ;-) Arnomane 21:55, 13 June 2009 (UTC)

A better solution would be to use SVG images with multiple language support. We're still waiting for full SVG support in browsers. If you put multiple languages into the SVG image itself, essentially no change is required in this extension. We'll have to wait for this SVG support, though. --Michael Daly2 18:16, 14 June 2009 (UTC)
Text labels would be very useful but I don't think it's realistic to hope for a SVG version of most images. Wouldn't that mean changing a huge number of images? 22:37, 30 June 2010 (UTC)

Additional rationale

On the English Wikipedia, there is an image of a carburettor labelled with English text. The same image is used on several non-English Wikipedias, w:gu:કાર્બ્યુરેટર, w:hi:कार्ब्युरेटर, w:id:Karburator, w:ja:キャブレター, w:ms:Karburetor. In each case, these non-English pages have an image with English labels, not exactly ideal. So should there be copies of this image with text modified for each different language? That would be quite laborious and result in many duplicate images.

And this happens repeatedly: a quick search shows bicycle, flower, electromagnetic spectrum,...

Having text labels handled by imagemap would allow the labels to be handled/translated separately from the image. It might also help along the development of a Wikimedia visual dictionary/picture dictionary project. 22:37, 30 June 2010 (UTC)

Problems with {{{..}}} in links

Hi. Thanks for the great extension! However, I have a problem. I have the following:

imagemap|Image:Button_download.gif|center|Download this article
default [{{{Article_Link}}}]
desc none

But it says "Error: no valid link was found at the end of line 3". So I read this page and then tried:

{{#tag:imagemap|Image:Button_download.gif|center|Download this article
default [{{{Article_Link}}}]
desc none

But that throws the error "Error: at least one area specification must be given". I tried adding a rect etc, but it still throws the error. Any ideas? Many thanks! [User:Mitchelln|Mitchelln]] 11:43, 18 June 2009 (UTC)

Mark the selectable arrea

Feature requests : It would be nice if the area which is clickable can be displayed with f.e. dotted line. Then the user knows, without the need of moving the mouse, which area is selectable. This is especialy usefull for small area's and for area's which are hard to gues it is (or it might be) selectable. It would be perfect if the line type and colour can be set different for each link. Each link type can have its own colour so the user knows what to expect. Imagemap is a very nice extension which I use a lot. --BernardHulsman 15:46, 24 June 2009 (UTC)

Testing and Suggestion


Can you make a syntax element for background

  • transparent
  • white
  • autodetect (if the image doesn't have a border e.g. autodetct the background components color. e.g. if use it in article (background is article space),


  • color;RGB (enter RGB color or Hexadecimal colors)
  • color;CMYK (enter RGB color or Hexadecimal colors)

Note: if the image is GIF don't define it, if you really want a background color try developing a method for Gradient syntax.

No Border Test

Google wordmark.svg
About this image

-- 01:15, 29 June 2009 (UTC)

Imagemap just provides whatever is available from the image link extended syntax, so if you want anything changed in that regard, you should go to MW's bugzilla and put in a request for the image link syntax to be extended further. --Michael Daly2 17:34, 29 June 2009 (UTC)

Thanks Michael, done so bugzille Imagemap display clickable area --BernardHulsman 13:22, 6 July 2009 (UTC)

Bug: blank page if imagemap tag is used

I have ImageMap r35980 installed on MediaWiki 1.13.4 PHP 5.1.6 (apache2handler) MySQL 5.0.22.

It is well installed -Special:Version) but if I use it the page is not render anymore, it gives me a blank page with no error printed on screen.--almaghi 10:15, 1 July 2009 (UTC)

I only manage to get the error "Error: must specify an image in the first line" when no image is specified.
My ImageMagick seems to work also. --almaghi 10:17, 1 July 2009 (UTC)
Moved to support desk. almaghi 12:19, 1 July 2009 (UTC)
Enable error logging and see what the error is when the blank page is produced.
Since you are using MW1.13, the 1.13-compatible version of Imagemap is r37957. This is on SVN
--Michael Daly2 15:53, 1 July 2009 (UTC)

Highlight outlines

Is it possible to highlight the outlines of areas while the cursor is hovering on them? --百楽兎 00:29, 15 August 2009 (UTC)

Not really. In the olden days the trick was, for each area, to make a different image with that area hilighted, and swap them with javascript. A very bad hack. Splarka 07:48, 15 August 2009 (UTC)

customizing desc icon length

For a small (or bigger) desc-20.png icon, like desc-10.png, we can add a hard-coded customization at ImageMap_body.php:

const DESCLEN = 10; # 10, 20 (default), ...
static function render( $input, $params, $parser ) {
	if ( !$magnify->length && $descType != self::NONE ) {
		$dl = self::DESCLEN;
		# Add image description link
			$marginLeft = $thumbWidth - $dl;
			$marginTop = -$dl;
		$descImg->setAttribute( 'src', "$wgScriptPath/extensions/ImageMap/desc-$dl.png" );

--Krauss 11:33, 20 October 2009 (UTC)

Alt text

Yes, there is a section above that discusses this, but it seems to have been lost amongst the shuffle and I think this is something that needs to be fixed so imagemaps can be used more readily.

Currently image maps will insert the name of the article being linked to/the piped entry for the article into the alt parameter, the same as it puts into the title parameter. Is it, or can it be made possible, to set a custom alt text that is different from the text that will show up to users when they hover their mouse over the link? - Floydian 19:10, 27 October 2009 (UTC)

extension simply doesn't work.

mediawiki 1.11.2

php 5.2.6

mysql 5.0.67

imagemap installed per instructions. shows up in Special:Version

double checked that imagemagick was installed and in use. LocalSettings.php confirms both.

$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";



double checked that php DOM was installed. phptest script confirms.

DOM/XML enabled
DOM/XML API Version 20031129
libxml Version 2.6.16
HTML Support enabled
XPath Support enabled
XPointer Support enabled
Schema Support enabled
RelaxNG Support enabled

wiki markup:

it is what is seen below, with a few carriage returns.

what i get on the page:

<imagemap> Image:LogoMICCy.gif|150px|alt=Alt text default Go to main page </imagemap>

Filepath function does not work

Problably an stupid mistake from my side but the absolute path reference is not working

   Image:Food_icon.jpg|thumb|center|400px|alt=Dining room
   rect 0 0 100 100 [[ {{Media:Food_ch.mp3 test1}}]]
   rect 100 100 200 200 [http://www.google.com test2]

The first link is only jumping to the internal WIKI page containing the downloaded mp3 file The second external link is ok

What we wanted is simple an clickable sound array from an image

  • Step 1: upload an mp3 file eg Food_ch.mp3
  • Step 2: Test the access to the Media (music) file [{{FILEPATH:Food_ch.mp3}}]
         Note: This creates an nice direct url link to the file without maintanance in case the file
         name etc changes therefore we need an direct relation to the above file otherwise you could 
         use [http:// www.xxx.com/wiki/blablabla ]
  • Step 3: insert this link to the above example
   Image:Food_icon.jpg|thumb|center|400px|alt=Dining room
   rect 0 0 100 100 [{{FILEPATH:Food_ch.mp3}}]
   rect 100 100 200 200 [http://www.google.com test2]

This produces an unexpected error Error: no valid link was found at the end of line 3

any good suggestions to recover from this error?

Actually it's the same on my wiki, the line 3 error comes from the accolades, and without the accolades no clicking sound is possible... JackPotte 07:42, 21 August 2010 (UTC)


Jack: in what way could i contact you more directly, for some additional questions? I will delete this line again, but need some additional information to see how we can resolve these issue's. >> worldexpatonline@hotmail.com

Use with Tooltips

I am wondering if its at all possible to use this with Extension:Tooltip something like:

rect 12 12 72 72 [[Chomp's Dinosaur Bone|<tooltip text="Chomp's Dinosaur Bone">{{:Chomp's Dinosaur Bone}}</tooltip>]]

This would be EXTREMELY useful for us when we're attempting to organize things on the wiki.

-- Nick (( nick [at] ashkir.com ))

Problem with image map extension and image map editor

Hello i've installed imagemap
and when i edit my article with the following code
<imagemap> File:Admin--Tests machine.jpg|thumb|1300px|My Test rect 33 362 12 8 [[Tractor]] desc bottom-left<br/> </imagemap>
I had this error :
'''<imagemap>: you must specify an image in the first line'''

I don't know what to do?
i 've already try to write Image instead of File but no success
i think imagemap is well installed

and i 've tried to use the image map editor (Imagemap plugin for FCKeditor)
http://martinezdelizarrondo.com/imagemaps/ and it takes no effect after having select the image map areas

so I don't know where does the problem (if there is an incompatibility whith this plugin? or if the problem is from mediawiki)

thanks for your help
Eva 11:36, 21 September 2010 (UTC)

It might come from the capitalization of your image letters. JackPotte 15:01, 21 September 2010 (UTC)
ok, but how can i do? when i upload a file, the title begin always with a capital letter
i've tried to use the Simple example without caption here with the same image, and the same code. And i've always the same error. i don't see where the error is
i use version of Mediawiki : 1.15.4
Database : MySql 5.1.36
OS : windows xp pro 2003
PHP version : 5.2.11
serveur Apache 2.2.11
Eva 08:06, 22 September 2010 (UTC)
resolved by disabling domxml Eva 13:08, 22 September 2010 (UTC)

Fatal error method domdocument::loadXML()

i have this error
Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in
C:\wamp\www\mediawiki\extensions\ImageMap\ImageMap_body.php on line 81

Fatal error: Call to undefined method domdocument::loadXML() in
C:\wamp\www\mediawiki\extensions\ImageMap\ImageMap_body.php on line 83
what does it mean please? could you help me?
thanks for your help 11:50, 22 September 2010 (UTC)

i've found the error : dom and domxml are incompatible. when i've disabled domxml.dll, it works fine Eva 13:07, 22 September 2010 (UTC)

Problem with image map extension and FCK editor

Hi, I've installed the latest ImageMap version on mediawiki 1.16.1, but I get an "Invalid image" message when I try to edit a page containing an Imagemap with FCKEditor.

Looking at the code, the error is thrown because of this condition around line 113 in ImageMap_body.php

if ( $denominator <= 0 || $numerator <= 0 ) {

The $numerator is equal to 0 since the

$thumbWidth = $imageNode->getAttribute('width');
$thumbHeight = $imageNode->getAttribute('height'); 

couldn't retrieve any value.

The HTML generated by the FCK editor doesn't have these attributes, it actually sets a _fck_mw_width attribute instead on the image tag, and doesn't set any _fck_mw_height. But the issue doesn't end here I guess, because even when I tried to hardcode the width/height values in ImageMap_body.php for my tests, I then got blocked on the following part (seems $parent ibacomes null)

$anchor = $imageNode->parentNode;
$parent = $anchor->parentNode;
$div = $parent->insertBefore( new DOMElement( 'div' ), $anchor );

Any idea to fix that ?

Same Problem here, Mediawiki 1.16.2 php5.3, latest Imagemap. HELP! -- 09:54, 24 May 2011 (UTC)

Image map with Templates in the image caption?

Hello, I would like to set up an image map with an image caption that includes the {{legend|#006699|color}} template. I got the impression that this is not possible and results in an error message. Is there a workaround for this? Thank you -- 19:09, 2 March 2011 (UTC)

External links in new window?

Is it possible to make external links open in a new window?

Venia 10:39, 25 October 2011 (UTC): I've patched my version to open a link in a new window if a "!" is appended to the link:

# next opens in new window
rect 0 0 100 100 [[Media:Video1.wmv{{!}}Video1]]!
# next one not
rect 0 100 100 200 [[Media:Video2.wmv{{!}}Video2]]
desc none

To do this add in ImageMap_body.php:

			# Find the link
			$link = trim( strstr( $line, '[' ) );
			// Add this to check for trailing !
			if (substr($link,-1,1)=='!') {
				$innewwindow = true;
				$link = substr($link,0,-1);
			} else $innewwindow = false;
			// End of added code


			# Construct the area tag
			$attribs = array();
			// Add this to realise the target 
			if ( $innewwindow ) $attribs['target'] = '_blank';
			// End of added code

Install Issue - doesn't appear in list of extensions for my wiki after install

Just tried to install this into my wiki. But it's not working. Have installed several other extensions in the past - and followed the instructions carefully.

It doesn't appear in the list of extensions installed under Special:Version in my wiki. Also, the <imagemap> tags in test image maps are just left as they are in my wiki test page.

I've done the require_once and uploaded the files, and also if I remove the ImageMap folder from the site immediately get an error message so it is obviously getting included in the LocalSettings. Tried both the 1.16 and the 1.11 versions of the extension with same effect.

What am I missing? Anyone got any ideas?


Map Section Text

How do i get text to show up over the area where the Map Coords are?

I have the mediawiki link that the click-through goes to but i also want a text overlay of the area.

Text, images, borders and hover options

I feel that Wikipedia is somewhat diminished by not being able to show on an image, areas/rectangles and text, and optional hover capabilities. On the plus side, I think it would greatly enhance diagrams to be able to do so, and I guess something like jQuery could enable this to be done. On the downside, this capability might not be compatible with certain mobile devices and hard printed copies.

Just look at the wonderful overlay examples here, and David Lynch's jQuery Map Highlight demo here. --Iantresman 14:37, 26 November 2011 (UTC)