Template:File link

From Project Mailer
Revision as of 17:37, 24 June 2019 by Grlucas (talk | contribs) (Created page with "<includeonly>{{safesubst:#invoke:File link|main}}</includeonly><noinclude> {{documentation}} <!-- Categories go on the /doc subpage, and interwikis go on Wikidata. --> </noinc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Template documentation[view] [edit] [history] [purge]

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 documentation at mediawiki.org.

Usage

Basic usage

{{file link|file=filename}}

All parameters

{{file link
| file       = filename
| format     = 
| formatfile = 
| border     = 
| location   = 
| alignment  = 
| size       = 
| upright    = 
| link       = 
| alt        = 
| caption    = 
| page       = 
| class      = 
| lang       = 
| start      = 
| end        = 
| thumbtime  = 
}}

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 [[File:Bad Title Bad Title Example.png|link=]] then you can use the special value _BLANK. The template will convert this into a true blank value.

The available parameters are:

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

To see the effect of each of these parameters, see the images help page on mediawiki.org.

Examples

Description Code Output Rendered output
With the file only {{file link|file=Bad Title Example.png}}
[[File:Bad Title Example.png]]
Bad Title Example.png
With format, size, link and caption options {{file link|file=Bad Title Example.png|format=thumb|size=220px|link=Wikipedia:Sandbox|caption=An example.}}
[[File:Bad Title Example.png|thumb|220px|link=Wikipedia:Sandbox|An example.]]
An example.
With format, size, and border {{file link|file=Bad Title Example.png|format=frameless|size=220px|border=true}}
[[File:Bad Title Example.png|frameless|border|220px]]
Bad Title Example.png
With _BLANK {{file link|file=Bad Title Example.png|format=thumb|link=_BLANK}}
[[File:Bad Title Example.png|thumb|link=]]
Bad Title Example.png

See also