Jump to content

Manual:Linked images

From mediawiki.org
(Redirected from Help: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.

However, there are several ways to override this link:

link= syntax

[edit]

Direct internal or external links from images are possible using the syntax documented at Help:Images .


In your wikicode:

[[Image:Wiki.png|50px|link=MediaWiki]]

This will make a 50px width picture with a link to the page MediaWiki:

If you put the link empty, the image will no longer be clickable.

[[Image:Wiki.png|50px|link=]]


External image syntax

[edit]

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:

After enabling $wgAllowExternalImages , you can also embed an image by simply typing the URL of the image.

For example,

https://example.com/images/image_file.png

will display the image on screen.

<span class="plainlinks">[https://linktopage https://linktoimage]</span>

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

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

This has the disadvantage of not registering the link, or the image use, as well as not being easily portable to forks and mirrors.

Raw HTML

[edit]

If you enable $wgRawHtml , you can use ‎<img> tags freely, but this method is highly insecure. On prior versions of MediaWiki you could have used the Manual:$wgAllowImageTag (removed in 1.42) option which allows <img> and is more secure than raw HTML.

There are, however, some extensions to make it safer, see Manual:$wgRawHtml for details.

ImageMap extension

[edit]

Extension:ImageMap can be deployed to enable more advanced customization of where an image links to, such as specific pixels pointing to specific places.

See also

[edit]