Extension:AnyWikiDraw

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
AnyWikiDraw drawing editor

Release status: experimental

AnyWikiDraw-Screenshot.png
Implementation Parser function, Page action
Description Allows to edit SVG, PNG and JPEG images directly in a page using a Java applet.
Author(s) Werner Randelshofer (Rawcodertalk)
Latest version 0.17 (2010-05-27)
MediaWiki 1.7 – 1.15 only
License Client-side code: Creative Commons Attribution 3.0 and/or LGPL,
Server-side code: GPL
Download http://sourceforge.net/projects/anywikidraw

Translate the AnyWikiDraw extension if possible

Check usage and version matrix; code metrics

The AnyWikiDraw extensions adds a {{#drawing:}} tag to the MediaWiki parser which allows to edit SVG, PNG and JPEG images directly in a page using a Java applet.

This extension is also available for MoinMoin, PmWiki, TWiki, and Foswiki.

Usage[edit | edit source]

The tag has the following form

{{#writing:image.svg|width|height}}

  • The tag needs to be put into two curly braces.
  • The name of the tag is #drawing:
  • The parameter image.svg specifies the name of the image file. If you specify an image file that does not yet exist in your Wiki, the image is created the first time you save a drawing.
  • The image name may have one of the following extensions: svg, png, jpg.
  • The parameter width specifies the width of the image
  • The parameter height specifies the height of the image

To draw the image HappyWiki.svg with a width of 400 pixels and a height of 300 pixels on a page, insert the following tag:

{{#drawing:HappyWiki.svg|400|300}}

Installation[edit | edit source]

Security considerations[edit | edit source]

Before installing this extension, please consider whether you want to do the following configuration changes on your MediaWiki installation:

  • You must grant access to session cookies to JavaScript and Java.
    You may not want to do this if your wiki embeds JavaScript code from untrusted sources.
    For example if your wiki embeds banners and advertisements from a third party system.
  • You need to allow file upload.
    You may not want to do this if your wiki allows user account creation by people you do not know.

Installation steps[edit | edit source]

  1. Make sure the StringFunctions and ParserFunctions extensions are installed.
  2. Enable cookie access for JavaScript and Java Applets in the LocalSettings.php file.
  3. Enable file upload in the LocalSettings.php file.
  4. Optional: Install an SVG converter in your MediaWiki installation, for example ImageMagick, and enable it in the LocalSettings.php file.
    You can omit this step, if you only want to edit PNG and JPEG images.
  5. Copy the AnyWikiDraw folder into the extensions folder of your MediaWiki installation.
  6. Enable AnyWikiDraw in the LocalSettings.php file.

Changes to LocalSettings.php[edit | edit source]

// Enable cookie access for JavaScript and Java Applets
$wgCookieHttpOnly = false;

// Enable file upload
$wgEnableUploads = true;

// Enable an SVG converter, for example ImageMagick
$wgUseImageMagick = true;
$wgImageMagickConvertCommand='/opt/local/bin/convert';
$wgSVGConverterPath='/opt/local/bin';
$wgFileExtensions[] = 'svg';

// Enable AnyWikiDraw
require_once("$IP/extensions/AnyWikiDraw/AnyWikiDraw.php");

To Do[edit | edit source]

This extension is in experimental state, because its functionality is incomplete, and because there are some known issues:

Missing functionality[edit | edit source]

  • Support for the ODG file format is missing. ODG is the Open Document Drawing format used by Open Office, Neo Office and other open source office programs.
  • Support for the TWikiDraw and PmWikiDraw file formats is missing.
  • SVG Color gradients are displayed but can not be edited.
  • SVG Markers are not yet supported.
  • The offline version of AnyWikiDraw is missing.

Known issues[edit | edit source]

  • Saves silently fail when editing an image without being logged into the wiki.
  • AnyWikiDraw only works with the specified MediaWiki versions.
  • Browsers don't refresh images after they are saved. We need either find a way to clear the image cache of the browser, or to deliver images without letting the browser cache them.
  • Pages which use the drawing tag are not listed as linking to the image file.
  • It is not clear, how we can add support for image formats like ODG .odg, TWikiDraw .draw and PmWikiDraw .draw to MediaWiki.

Links[edit | edit source]

A demo of the drawing applet can be tried out at http://www.randelshofer.ch/anywikidraw/demo/anywikidraw_for_twiki_demo.html