Extension:ImageLink

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

Release status: stable

Implementation Parser function
Description Creates a clickable image link using an image in an article.
Author(s) Jean-Lou Dupont
Last 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 $)
Check usage and version matrix

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.

Contents

General note [edit]

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]

Note [edit]

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

Local Image [edit]

  • {{#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]

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

Default Image [edit]

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]

  • {{#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]

HTML attribute Notes
target e.g. target=_blank for opening link in new window
alt
height
width
alt
title e.g. for tooltip functionality
border
class

Event Attributes [edit]

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

Examples [edit]

  • {{#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]


Installation [edit]

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

LocalSettings.php [edit]

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]

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]

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]

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]

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

Notes [edit]

Other Extensions From the same author [edit]

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]

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


History [edit]

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]

Changes in Trunk [edit]

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