Changes

Jump to navigation Jump to search
m
Remove a deleted template
{{Documentation subpage}}
{{lua|Module:File link}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->

This template is used to construct wikitext links to files. It is primarily useful for templates that use complicated logic to make file links. Simple file links should be made with wikitext markup directly, as it uses less resources than this template. For help with wikitext file markup please refer to the [[mw:Help:Images|documentation at mediawiki.org]].

== Usage ==

'''Basic usage'''

&#123;&#123;file link&#124;file=''filename''&#125;&#125;

'''All parameters'''

&#123;&#123;file link
&#124; file = ''filename''
&#124; format =
&#124; formatfile =
&#124; border =
&#124; location =
&#124; alignment =
&#124; size =
&#124; upright =
&#124; link =
&#124; alt =
&#124; caption =
&#124; page =
&#124; class =
&#124; lang =
&#124; start =
&#124; end =
&#124; thumbtime =
&#125;&#125;

== Parameters ==

Whitespace will be trimmed from parameters, and blank values will be ignored. This is to make it easier to construct complicated file links using templates. If you wish to use a blank value for syntax such as <code><nowiki>[[File:Bad Title Bad Title Example.png|link=]]</nowiki></code> then you can use the special value <code>_BLANK</code>. The template will convert this into a true blank value.

The available parameters are:

* <code>file</code> - the filename. (required)
* <code>format</code> - the file format, e.g. 'thumb', 'thumbnail', 'frame', 'framed', or 'frameless'.
* <code>formatfile</code> - a filename to specify with the 'thumbnail' format option. The filename specified will be used instead of the automatically generated thumbnail.
* <code>border</code> - set this to true or "yes" (or any other value recognized as true by [[Module:Yesno]]) to set a border for the image.
* <code>location</code> - the horizontal alignment of the file, e.g. 'right', 'left', 'center', or 'none'.
* <code>alignment</code> - the vertical alignment of the file, e.g. 'baseline', 'middle', 'sub', 'super', 'text-top', 'text-bottom', 'top', or 'bottom'.
* <code>size</code> - the size of the image, e.g. '100px', 'x100px' or '100x100px'.
* <code>upright</code> - the 'upright' parameter, used for setting the size of tall and thin images.
* <code>link</code> - the page that the file should link to. Use the blank string '' to suppress the default link to the file description page''.
* <code>alt</code> - the alt text. Use the blank string '' to suppress the default alt text''.
* <code>caption</code> - a caption for the file.
* <code>page</code> - sets a page number for multi-paged files such as PDFs.
* <code>class</code> - adds a <code>class</code> parameter to image links. The MediaWiki software adds this parameter to the <code>class="..."</code> attribute of the image's <code><nowiki><img /></nowiki></code> element when the page is rendered into HTML.
* <code>lang</code> - adds a language attribute to specify what language to render the file in.
* <code>start</code> - specifies a start time for audio and video files.
* <code>end</code> - specifies an end time for audio and video files.
* <code>thumbtime</code> - specifies the time to use to generate the thumbnail image for video files.

To see the effect of each of these parameters, see the [[mw:Help:Images#Format|images help page on mediawiki.org]].

== Examples ==


{| class="wikitable"
|-
! Description
! Code
! Output
! Rendered output
|-
| With the file only
| <code><nowiki>{{file link|file=Bad Title Example.png}}</nowiki></code>
| {{#tag:pre|{{file link|file=Bad Title Example.png}}|style=white-space:pre-wrap}}
| {{file link|file=Bad Title Example.png}}
|-
| With format, size, link and caption options
| <code><nowiki>{{file link|file=Bad Title Example.png|format=thumb|size=220px|link=Wikipedia:Sandbox|caption=An example.}}</nowiki></code>
| {{#tag:pre|{{file link|file=Bad Title Example.png|format=thumb|size=220px|link=Wikipedia:Sandbox|caption=An example.}}|style=white-space:pre-wrap}}
| {{file link|file=Bad Title Example.png|format=thumb|size=220px|link=Wikipedia:Sandbox|caption=An example.}}
|-
| With format, size, and border
| <code><nowiki>{{file link|file=Bad Title Example.png|format=frameless|size=220px|border=true}}</nowiki></code>
| {{#tag:pre|{{file link|file=Bad Title Example.png|format=frameless|size=220px|border=true}}|style=white-space:pre-wrap}}
| {{file link|file=Bad Title Example.png|format=frameless|size=220px|border=true}}
|-
| With _BLANK
| <code><nowiki>{{file link|file=Bad Title Example.png|format=thumb|link=_BLANK}}</nowiki></code>
| {{#tag:pre|{{file link|file=Bad Title Example.png|format=thumb|link=_BLANK}}|style=white-space:pre-wrap}}
| {{file link|file=Bad Title Example.png|format=thumb|link=_BLANK}}
|}
==See also==
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->

}}</includeonly>
Anonymous user

Navigation menu