Talk:MW: ImageMap Extension

From ChekMate Security Group

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

The following is a typical map file: (I used GIMP Imagemap Plugin to create this one - there are other imagemap makers or you can make it yourself.) (Smcnaught)

<map name="map">
<!-- #$-:Image Map file created by GIMP Imagemap Plugin -->
<!-- #$-:GIMP Imagemap Plugin by Maurits Rijk -->
<!-- #$-:Please do not edit lines starting with "#$" -->
<!-- #$VERSION:2.0 -->
<!-- #$AUTHOR:Shannon McNaught -->
<area shape="rect" coords="75,0,136,85" href="http://www.yourhost.com/wiki/index.php/BK001" />
<area shape="rect" coords="0,56,72,137" href="http://www.yourhost.com/wiki/index.php/FE001" />
<area shape="rect" coords="137,58,216,135" href="http://www.yourhost.com/wiki/index.php/ZM001" />
<area shape="rect" coords="213,0,286,81" href="http://www.yourhost.com/wiki/index.php/SC001" />
<area shape="rect" coords="285,53,349,137" href="http://www.yourhost.com/wiki/index.php/MN001" />
<area shape="rect" coords="348,1,426,85" href="http://www.yourhost.com/wiki/index.php/DB001" />
<area shape="rect" coords="427,53,497,136" href="http://www.yourhost.com/wiki/index.php/AM001" />
<area shape="rect" coords="398,164,477,280" href="http://www.yourhost.com/wiki/index.php/IX535" />
<area shape="rect" coords="328,205,398,315" href="http://www.yourhost.com/wiki/index.php/IX535" />
<area shape="rect" coords="206,385,308,499" href="http://www.yourhost.com/wiki/index.php/509B" />
<area shape="rect" coords="59,386,156,498" href="http://www.yourhost.com/wiki/index.php/509A" />
<area shape="rect" coords="23,206,103,299" href="http://www.yourhost.com/wiki/index.php/SUNK001" />
<area shape="rect" coords="102,165,178,253" href="http://www.yourhost.com/wiki/index.php/ST001" />
<area shape="rect" coords="177,206,252,294" href="http://www.yourhost.com/wiki/index.php/PD001" />
<area shape="rect" coords="250,166,326,252" href="http://www.yourhost.com/wiki/index.php/SN001" />
<area shape="rect" coords="34,309,326,372" href="http://www.yourhost.com/wiki/index.php/NetworkTAP" />
</map>

Contents

Imagemapping Tools

  • Clickable Image Map Maker. This web page allows the user to select an image file on his own local hard drive, then creates a second page using that image, and allows the user to very quickly generate the HTML code for an imagemap to be used in his own files. It also offers some handy pop-up menus to speed the process of coding the actual href. Complicated maps can be created in less than a minute (no kidding). Requires a Javascript and frames capable browser, designed and tested on a Mac using Netscape Navigator.
  • Client-Side Image Map Editor (CSIME) is a standalone Java application for maintaining the HTML tags that form a client-side image map. The CSIME allows the creation of RECT, CIRCLE, and POLY regions overlaying a GIF or JPEG image. Cool features include 1) use your Netscape bookmarks file, 2) import a client-side image map straight from a web server, 3) export to server-side image map format, 4) fading an image to allow easier editting, and more. Written in Java, the CSIME is platform independent (runs on UNIX, Mac, Win95/NT, OS/2, etc). The CSIME is freeware.
  • Glorglox is a replacement for NCSA's imagemap. It allows you to make imagemaps with irregular and/or discontiguous areas, and is much more flexible for some applications.
  • Imaptool is for creating client-side image maps. It's for the X Window System and tested with Linux 1.2.13.
  • I-View is small yet powerful off-line HTML browser. Designed specially for HTML authors, Internet & CD-ROM publishers. Supports imagemaps. I-View is available for Windows. (about 400K)
  • Mapedit is a WYSIWYG editor for imagemaps, available for Microsoft Windows and the X Window System. Use Mapedit to generate, or convert to, NCSA, CERN, or client-side map files.
  • Mapmaker starts with a directory full of different sized images, and uses xv and several ppm utilities to create an imagemap. The imagemap is an esthetically pleasing matrix of thumbnails which expand to the full picture when selected.
  • MapMaker for Macintosh is a full featured imagemap utility which can create and open NCSA, CERN and Clientside maps. It supports both GIFs and JPEGs and has some additional useful features, such as a testing mode, zooming, onMouseOver-support and much more.
  • Map This - freeware 32 bit application for creating, editing, and converting map files. Supports NCSA, CERN, and Client Side Image Maps. Handles both GIF and JPG images. Runs under Win 3.1/3.11 with Win32s installed; Win95 and WinNT.
  • WebMap - The original macintosh Imagemap editor.
  • Web Hotspots 2.0 is an image map editor for Windows supporting both server and client-side image maps, multiple image file formats including GIF and JPEG and more microscopic (zoomed-in) editing, advanced shape manipulation, subtractive regions (cutouts), starter host page generation, insertion of host (i.e., IMG) entries into existing pages, and live testing for Windows Sockets 1.1 compliant configurations.

Error messages

I'm getting 3 error messages on any webpage that uses <ImageMap> during a 'Show Preview' of an edit. The submitted page doesn't show the errors, but doesn't hyperlink when clicking on the coordinates.


Warning: file(/var/www/html//wiki/images/6/63/GPINetArch.map): failed to open stream: No such file or directory in c:\program files\easyphp1-8\www\wiki\extensions\ImageMap.php on line 71

Warning: array_map(): Argument #2 should be an array in c:\program files\easyphp1-8\www\wiki\extensions\ImageMap.php on line 71

Warning: Invalid argument supplied for foreach() in c:\program files\easyphp1-8\www\wiki\extensions\ImageMap.php on line 76

Using MediaWiki 1.6.3

The .map file I'm using is

<MAP NAME="Network Layout">
<AREA SHAPE="RECT" COORDS="6,143,71,181" HREF="#Citrix Servers">
<AREA SHAPE="RECT" COORDS="69,103,143,122" HREF="Servers#GPI_Mail">
</MAP>

I've also tried with trailing slashes in the <area> tags as indicated in the example.

Ok, I am not sure about the warning errors as I was unable to recreate the problem. In regards to your imagemap map file. I believe the issue is related to the upper case <MAP NAME="....">. Linux is case sensitive and I built the plugin where the hyperlinks were lowercase. The script also does not like a space in the name= variable.

It would also be helpful if you could provide a URL so that I can see how the script reacts on your system.

The following may work better, replace the following line

    $line = preg_replace('/\sname=\"[a-zA-Z0-9]+\"/',$replacestr,$line);

with

   $line = preg_replace('/\sNAME=\"[a-zA-Z0-9 ]+\"/i',$replacestr,$line);

-- Smcnaught - 05:51, 11 July 2006 (UTC)

Another error message

I'm trying to implement here but am getting the following error:

Path to mapfile is incorrect or file does not exist. mapfile should look like: /var/www/html/wiki/images/4/4d/Fish.map

How do I set the path to the map file...I have hundreds of images in the wiki, how could I find out in which folder my map file exists???

I would recommend going to /wiki/index.php/Special:Imagelist and click on the map file. This will display the map file in the browser, and it will display the full path of the map file on the address bar. Hope that helps. (smcnaught)
Thanks but I'm still confused. Where do I enter the path for the map file...in ImageMap.php?? If the path for the map is http://www.wiki.artdirectors.org/%7Ewiki2/images/4/4c/Mandala6g_serverside.map ...what would be entered?
I am having the same exact problem. I've tried the code with the standard Media: reference, but it won't recognize the map file. I've tried variations of the URL but haven't had any luck with THAT either (i.e., not sure what the proper syntax might be for plugging the URL into the Map= statement). Thanks! Samspectre 08:02, 21 February 2008 (MST)

Security issues

I noticed a couple serious security problems with this extension. It does no checking on the $Mapurl, so someone can use a ../../../.. path to display the contents of any file on the server. It also does no checking on the contents of the mapfile, so you can use it to bypass MediaWiki's HTML sanitizer and output any HTML (e.g., web forms, JavaScript, etc.) --GregU 05:33, 22 November 2006 (MST)

Syntax question

I noticed some use of the imagemap syntax on wikipeda, so we downloaded your extension to our test wiki. It seems the syntax is different than what I'm seeing on wikipedia. Here's an example of the wikipedia syntax:

[1]

Is there a way to make this syntax work with your extension? We don't have requirements for complex maps, just clickable images. Thanks. Ahonent 20:43, 6 February 2007 (MST)

I have no immediate plans to add this functionality. If someone wants to update this extension then I would definitely give the appropriate credit. Schedule has been very hectic. -- smcnaught 11:30, 12 February 2007 (MST)

Error Message

l keep on getting a sql server error when l use the ImageMap.php extension

   Database error
    A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:
    (SQL query hidden)
    from within function "". MySQL returned error "1146: Table 'lab_wiki.cur' doesn't exist (localhost)".

any help would be much appreciated


ImageMap should have nothing to do with the MySQL. Therefore there is something else that is causing the issue. -- smcnaught 11:29, 12 February 2007 (MST)

  • Hi, I've installed your extension and I'm getting the same error on my mediawiki page where I'm trying to use the tags. I'm using Mediawiki 1.6. Any possible ideas about where this error would be coming from? Thanks for your help (and extension). --Jooolia 08:15, 1 March 2007 (MST)