From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png

Release status: stable

Implementation Parser function
Description Creates a clickable image link using an image in an article.
Author(s) Jean-Lou Dupont
Latest version 1.7.1
MediaWiki 1.8 - 1.17.*
License No license specified
Download SVN
See SVN ($Id: ImageLink.doc.wikitext 1198 2008-07-14 10:34:54Z jeanlou.dupont $)

Translate the ImageLink extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Creates a clickable image link using an image in an article and an article title. This image can be either stored in the Image namespace or accessible through an interwiki prefix. The article title may or may not exist in the database.

The extension also supports the link-less mode thereby enabling a one-stop solution for both link and link-less requirements.

Furthermore, the extension also supports events but only on edit protected pages.

Lastly, the extension provides the parser function #iconlink which provides a clickable URL with the site's favicon.ico as image.

General note[edit | edit source]

This extension is needed for MediaWiki installations until version 1.13.x.

However, since MediaWiki version 1.14+, a parameter "link=" can be added to any image, without the need to install an extension. But only basic functionality of this extension was integrated into MediaWiki software 1.14+. Some HTML attributes and all of the event attributes are still not part of the MediaWiki software.

Usage[edit | edit source]

Note[edit | edit source]

Please use the #img parser function instead of the older #imagelink one.

Local Image[edit | edit source]

  • {{#imagelink: image-page-name | page name |alternate text | width | height | border }}
  • {{#img: image=image-page-name [|page=page-to-link-to] [|alt=alternate-text] [|height=height-parameter] [|width=width-parameter] [|border=border-parameter] [|title=title-parameter] [|default-image]}}

See W3Schools on IMG tag for more details.

Link-Less option[edit | edit source]

If no page name is given, then no anchor (i.e. HTML < a> element) will be generated.

Default Image[edit | edit source]

When the parameter image points to a non-existing image page, then default parameter (if specified) is used as image page. Note that for interwiki link, this option is not supported.

InterWiki accessible Image[edit | edit source]

  • {{#imagelink: interwiki_prefix:image-page-name | page name | alternate text | width | height | border }}
  • {{#img: image=interwiki_prefix:image-page-name ... }}

List of supported HTML attributes[edit | edit source]

HTML attribute Notes
target e.g. target=_blank for opening link in new window
title e.g. for tooltip functionality

Event Attributes[edit | edit source]

Event attributes supported: onchange, onsubmit, onreset, onselect, onsubmit, onreset, onselect, onblur, onfocus, onkeydown, onkeyup, onkeypress, onclick, ondblclick, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup.

Examples[edit | edit source]

  • {{#imagelink: New Clock.gif | Admin:Show Time | Current Time | 32 | 32 | 2 }}
  • {{#img: image=Star.png | page=Starred Page | height=100% | title=Some starred page }}
  • {{#iconlink: site=http://www.yahoo.com | domaincheck=y | target=_blank | content=YAHOO! }}

Dependency[edit | edit source]

Installation[edit | edit source]

See the Mediawiki Extension table entry "download" above.[1]

LocalSettings.php[edit | edit source]

Extension:ExtensionManager: See footnote[2]

require_once "$IP/extensions/ImageLink/ImageLink.php";
  • Since this Extensions is depending on StubManager, add the line after the StubManager include, or else your Wiki won't work.

PEAR[edit | edit source]

PEAR is a repository of PHP software code.

pear channel-discover mediawiki.googlecode.com/svn
  • Install extension through PEAR:
pear install mediawiki/ImageLink
  • Add the following to LocalSettings.php[2][3]:
require 'MediaWiki/ImageLink/ImageLink.php';
  • Note that the required version of PEAR must be respected. Currently, the minimum version of PEAR usable with this channel is v1.6.2. Perform the following command to upgrade to the latest version of PEAR:
pear upgrade pear

Upgrades through PEAR[edit | edit source]

Sometimes, it is necessary to clear PEAR's cache in order to perform upgrades.

pear clear-cache

or use the force method:

pear upgrade --force mediawiki/ImageLink

PEAR Web Frontend[edit | edit source]

For easier remote package management, PEAR Frontend WEB can be installed. Installation notes can be found here. An example of the WEB frontend is available here.

RSS feed[edit | edit source]

To keep up-to-date with this channel, use the following RSS feed__Rss2.jpg.

Notes[edit | edit source]

Other Extensions From the same author[edit | edit source]

Consult User Jldupont's page.

  1. The most recent release is always available through the extension's PEAR and SVN repositories. This page is not necessarily up-to-date.
  2. 2.0 2.1 2.2 Extension:ExtensionManager does not require any modification to LocalSettings.php because ExtensionManager includes the extension.
    Note that if PHP code caching is in place (e.g. APC, eAccelerator), then to successfully complete the installation a cache flush might be needed.
  3. Modifications to LocalSettings.php is only necessary if not using Extension:ExtensionManager

Optional Dependency[edit | edit source]

The PEAR package Validate can be installed: the extension performs additional sanity check for {{#iconlink}} site parameter.

History[edit | edit source]

Release Notes
1.3.0 Addition of parser function #img & addition of title parameter for tooltips
1.4.0 * Simplified operation (removal of ParserAfterTidy hook) * Added default image functionality
1.4.1 Minor bug fix
1.5.0 Added support for event parameters
1.5.1 Added support for unrestricted event parameters in the MediaWiki namespace
1.6.0 Added 'content' & 'target' parameters for <a>, added '#iconlink' parser function
1.7.0 Added URL fragment support i.e. page-to-link-to#section-to-link-to (issue 22)
1.7.1 Added fix for "#tab=section"

Sites using this extension[edit | edit source]

Changes in Trunk[edit | edit source]

  • Added a space between $content and img in anchor (thanks Mitchelln)