﻿ Help:Linked images - NetBeans Wiki

Help:Linked images


However, there are several workarounds for those that require them.


link= Syntax available since version 1.14



Old CSS workarounds for vanilla installs pre 1.14

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 Template:Mediawiki, nor is the background-image CSS attribute.

On these older versions, there were the following workarounds.

Site CSS



In MediaWiki:Common.css:

.imagelink_somename a {

In your wikicode:



For example on Image:Wiki.png, the image location is http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png (location format will differ depending on local settings), and the width and height would be set to 135px and 135px. So to make a link to the main page here using that logo, one would add to MediaWiki:Common.css:

.imagelink_wikilogo a {
  background-image: url("http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png") 

And then use the wikicode:


Which would give you:


Inline CSS

You can also attempt to superimpose an invisible link over an image via CSS, such as is done in Template:Click. An example of a typical click template is:




A less elegant trick is to make the image description page a redirect to the target. So for example Image:Wiki.png would be changed to content:

#REDIRECT [[MediaWiki]]

There are several disadvantages to this:

  • It doesn't always work, some installations/versions have internamespace redirects disabled.
  • The image appears at the top of the article. This is because MediaWiki redirects aren't really redirects, they simply bring the target page's data to the current URL, but on image description pages this is done after the image itself is shown.
  • It can only be done once per image.

Native with configuration change


External image syntax

If you enable Template:Mediawiki (which allows external images from any domain) or Template:Mediawiki (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:

After enabling Template:Mediawiki, you can also embed an image by simply typing the URL of the image.

For example
, will display the image on screen.

So for example, were external images allowed here, you could link to the Template:Mediawiki with http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png using wikicode like:

<span class="plainlinks">[{{fullurl:MediaWiki}} http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png]</span>



If you enable Template:Mediawiki, you can use <img> tags freely, but this method is highly insecure.

There are, however, some extensions to make it safer, see Template:Mediawiki for details.

Via extensions


Or you can invent your own linked image syntax, by writing an extension that registers it as a parser hook. See Template:Mediawiki for information on extending MediaWiki syntax.

Other options


See also

Not logged in. Log in, Register
