Extension talk:ImageMap
From MediaWiki.org
[edit] Active graphics
- you might add additional/optional columns for the onmouseover and onmouseout attributes - simply have a look at this:
http://www.mrbbc.org/files/de/cloudlevels.htm
- 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)
[edit] Does not work in Templates
Seems, the extension does not work in templates. If I write in a template:
<imagemap>
Image:Foo.jpg|100px|picture of a foo
rect 0 0 50 50 [[{{{1|}}}]]
desc bottom-left
</imagemap>
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)
If it was possible to use template parameters in this it would make replacing existing template CSS hacks much easier. 131.111.195.8 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 --202.134.25.5 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)
[edit] 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 2.0.0.1 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)
[edit] Polygons
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:
<imagemap> 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 </imagemap>
Output of this example:
Error: found poly with odd number of coordinates on line 4
What is also strange - on the original example (with circle and square) it shows only display but no keyboard:
<imagemap> 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 </imagemap>
Output of this example:
Error: found poly with odd number of coordinates on line 8
-
-
- 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:
<imagemap> 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 </imagemap>
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)
}
break;
case 'poly':
$coords = array(); /*<<<FIX*/
$coord = strtok( " \t" );
while ( $coord !== false ) {
$coords[] = $coord;
[edit] 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)
[edit] 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)
[edit] 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. --12.42.50.51 15:27, 17 January 2007 (UTC)
- Also, it would be nice if it were possible to use:
<imagemap>Image:whatever.jpg [[Wherever]]</imagemap> or <imagemap>Image:whatever.jpg 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. --12.42.50.51 15:34, 17 January 2007 (UTC)
<imagemap> Image:Foo.jpg|200px|picture of a foo circle 0 0 0 [[0]] default [[Display]] desc bottom-left </imagemap>
→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. --12.42.50.51 17:34, 17 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)
[edit] 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)
[edit] 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)
[edit] 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)
[edit] External linking
Would it be possible for this extension to support linking to external sites? Somethign like: -
<imagemap> Image:Firefox.jpg|200px|picture of Firefox default http://www.firefox.com desc none </imagemap>
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:
<imagemap> Image:Firefox.jpg|200px|picture of Firefox default [http://www.firefox.com] </imagemap>
[edit] Anchors
This doesn't seem to work with anchor links either e.g.
<imagemap> Image:Foo.jpg|100px|picture of a foo rect 0 0 50 50 [[#Polygons]] desc bottom-left </imagemap>
gives
with a link to http://www.mediawiki.org/wiki/ rather than #Polygons. the wub "?!" 16:25, 22 January 2007 (UTC)
[edit] 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', ),
[edit] 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
[edit] 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):
Urhixidur 20:40, 30 January 2007 (UTC)
[edit] 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)
[edit] 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.
GeraldR
- 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)
[edit] 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)
[edit] 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
[edit] Eliminate Case Sensitive Shape Names
I added a couple of lines to ImageMap_body.php:
here:
# 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)
[edit] 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)
[edit] 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?)
[edit] 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:
<imagemap> Image:MyImage.jpg|200px|picture of a foo default [[Foo type B]] desc none </imagemap>
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)
[edit] 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)
[edit] 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)
[edit] 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]]
[edit] 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)
[edit] Php Error
Right now the code works, but produces the following PHP error: [Wed Apr 18 16:03:03 2007] [error] [client 10.34.18.28] 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 10.34.18.28] PHP Warning: Invalid argument supplied for foreach() in /x/eng/wiki/xwikid/extensions/ImageMap/ImageMap_body.php on line 292
[edit] Special chars in external url
It seem extension done incorrectly when there are some special characters in external url. For example:
<imagemap> Image:wiki.jpg rect 0 0 50 50 [http://en.wikipedia.org/w/index.php?title=Main_Page&action=edit] desc none </imagemap>
The link will be http://en.wikipedia.org/w/index.php?title=Main_Page&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)
[edit] 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:
<imagemap> 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 </imagemap>
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.
[edit] 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)
-
-
[edit] 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:
[[some-article|[[image:foo.png]]]]
...therefore simply allowing [[image]] inside a usual link would also be an intuitive way for authors to include images within links.
[edit] error
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)
I was just about to correct myself. Thanks 130.102.0.178 07:39, 28 June 2007 (UTC)
[edit] Port to Mediawiki 1.7
Hi
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!
--208.17.34.25 15:21, 11 July 2007 (UTC)
[edit] 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.
- 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
continue;
}
No promises, but it looks reasonable. Michael Daly 19:54, 22 August 2007 (UTC)
[edit] "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. —The preceding unsigned comment was added by 217.120.159.198 (talk • contribs) . Please sign your posts with ~~~~!
- desc none does the trick :-) --Raymond 06:13, 29 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. —The preceding unsigned comment was added by 217.120.159.198 (talk • contribs) . Please sign your posts with ~~~~!
- 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)
<imagemap> Image:Foo.svg|200px|picture of a foo poly 0 0 0 0 [[Display]] desc none </imagemap>
[edit] 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)
[edit] 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:
Without circle:
[edit] 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). 84.57.191.5 17:53, 6 October 2007 (UTC)
[edit] 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" /> </map>
-
- 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)
[edit] 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.
[edit] 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? --66.102.80.212 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. --66.102.80.212 23:30, 21 February 2008 (UTC)
[edit] 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)
[edit] 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.
[edit] 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)
[edit] Display 2 imagemaps inline
Hi! i'm struggling with this problem, you can see better here:
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:
- Code:
{|
| <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 -> | <- 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
[edit] Error
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
???--68.9.226.101 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.--68.9.226.101 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)
-
[edit] Equations?
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. 82.32.4.243 21:19, 12 May 2008 (UTC)
[edit] 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??
[edit] <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)
[edit] 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)
[edit] Why?
This command doesn't work in a page where {{SUBPAGENAME}}=1 (at template namespace):
<imagemap>Image:{{SUBPAGENAME}}.svg
default [[w:]]</imagemap>
But
[[Image:{{SUBPAGENAME}}.svg]]
[[w:]]
works normally, and create
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,
{{#tag:imagemap|Image:{{SUBPAGENAME}}.svg
default [[w:]]
desc none
}}
- --Fryed-peach 10:36, 23 July 2008 (UTC)
[edit] 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)
[edit] 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:
- <imagemap>
- Image:Wiki.png|50px|WikiWiki
- rect 0 0 135 135 [[Special:Filepath/Wiki.png]]
- desc none
- </imagemap>
-

- Splarka 08:29, 21 November 2008 (UTC)
-
- Looks like this works perfectly; thanks!
--Ryan lane 14:42, 21 November 2008 (UTC)
- Looks like this works perfectly; thanks!
[edit] Javascript as part of Imagemap
Hi,
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?
-
- Jack




