ImageLink

From BITPlan Wiki
Jump to navigation Jump to search

OsProject

OsProject
id  ImageLink
state  active
owner  BITPlan
title  ImageLink
url  https://github.com/BITPlan/ImageLink
version  0.2.0
description  Renders an external image, optionally as a clickable link
date  2026/07/27
since  2008/03/20
until  


Extension
edit
name  ImageLink
url  https://github.com/BITPlan/ImageLink
purpose  Display Image and Link
since  2008/03/20
wiki  

Purpose

MediaWiki escapes a raw <img> tag in wikitext and the setting that used to permit it was removed in MediaWiki 1.41. A parser tag is not subject to that restriction, so <imgLink> is the way to place an externally hosted image — a Font Awesome icon, a status badge, a button glyph — into a page or a template on current MediaWiki.

Installation

get code

cd extensions
git clone https://github.com/BITPlan/ImageLink

modify LocalSettings.php

wfLoadExtension( 'ImageLink' );

Registration is via extension.json and needs MediaWiki 1.39 or later. ImageLink.php remains as a shim, so an existing require_once keeps working.

Usage

The tag name is imgLink.

plain image

<imgLink src="https://wiki.bitplan.com/font-awesome/svg/server.svg" size="48"/>

image linking to a wiki page

The tag content is the page.

<imgLink src="https://wiki.bitplan.com/font-awesome/svg/home.svg" title="home" size="32">Main Page</imgLink>

image linking anywhere

<imgLink src="https://wiki.bitplan.com/font-awesome/svg/book.svg" href="https://www.mediawiki.org" target="_blank" title="manual" size="32"/>

manual

Parameters

parameter meaning
tag content wiki page the image links to; empty and without href gives a plain image
src URL of the image; templates and magic words are resolved
img a complete img tag, used instead of building one from src
href link target; takes precedence over the tag content
title title attribute, and the link text when href is used
size width and height in pixels
width width in pixels, takes precedence over size
height height in pixels, takes precedence over size
target anchor target, e.g. _blank; default _self

Without src and without img the wiki logo is used.