Manual:Linked images

Images on a MediaWiki wiki will by default, link to the description page, so that licensing information, upload history, contributors, and full resolution versions are immediately available to the user when they click an image.

MediaWiki was for a long time designed to prevent manual manipulation of images in wikicode which may circumvent the link to description page operation: The <img> tag is specifically not whitelisted in the Sanitizer, nor is the background-image CSS attribute.

The simplest method, if your requirements for external images are specialized (that is, restricted to one page or one image), is to add a CSS rule to your MediaWiki:Common.css (or other CSS files, such as MediaWiki:Skinname.css or /skins/skinname/main.css, etc) giving child links of a certain class of object a background image. This method also has some security, as it requires editing the site-wide CSS files, meaning only sysops have access to modify the image shown.

This would give the link the background image specified, as well as the width and height of the image (which you have to set manually). To find the location of an uploaded file, go to the image description page and click the image itself, and copy the image location in the address bar.

Known problems: It doesn't work in text-only browsers, and in screen readers for the disabled, and possibly other situations. The technique of using CSS to change page content also completely breaks an article's web accessibility by contravening a WAI priority-one checkpoint.[1]

If you enable $wgAllowExternalImages (which allows external images from any domain) or $wgAllowExternalImagesFrom (which restricts the list of domains), anyone can then easily create an "external" link to an "external" image. External simply means: using the full URL rather than a local link, so you can link locally, but you need to use the full URL. The plainlinks class is used to remove the "external link" icon:

If you enable $wgRawHtml, you can use <img> tags freely, but this method is highly insecure. On newer MediaWiki you can use the Manual:$wgAllowImageTag option which allows <img> and is more secure than raw html.