Note: This template is used on a great lot of pages. In order not to put too much load on the servers, edits should be kept to a bare minimum. Please discuss proposed changes on the talk page first.
Afterwards, changes can initially be done at and tested with Template:F/sandbox: [edit].
|
![]() | Uses Lua:
|
Establishes a link to the file whose name is given in parameter #1 and displays the name without the prefix "File:".
Additional possibilities:
{{F |1= }}
Only Parameters 1, 2 and 3 are fixed, all other options are not fixed to any parameter position
Parameter | Description | Default | Status | |
---|---|---|---|---|
1 | File Name | Name of the file, with or without namespace; or* on the file description page/talk page.Underscores contained in the filename are replaced by spaces. | empty | required |
2 | Display Name | Any text, default is the file name (parameter #1). If there is no alternate text the parameter #2 instead can hold the first option. | File Name | optional |
3 d | Image size | Numeric value for the image sizeinpx. The picture is displayed inline in this size; 0 means: don't display Parameter d has precedence over 3 ; d= ord=- suppresses any display. | 0 | optional |
4 | Option | Option: b (lowercase B) to draw a border around the displayed picture | empty | optional |
5 | Option | Option: l (lowercase L) to display the image left of the file name Option: r (lowercase R) to display the image to the rightmost Option: c (lowercase C) to display the image in the center Option: u (lowercase U) to display the file name under (below) the image Option: Z (uppercase Z) to suppress the display of the file name | right of the filename | optional |
6 | Option | Option: n (lowercase N) to display the name not-linking to the file Leave empty to display the filename as a link to the file | empty | optional |
7 | Option | Option: + to display the namespace prefix “File:” as part of the link Option: - to display the namespace prefix “File:” not as part of the link If empty, don't display the namespace prefix “File:” at all | empty | optional |
8 | File Function Letter | Different functions can be performed, see File Function Letters. | empty | optional |
t | Separator | The separator can be any text string, used between displayed file name and displayed image Use uppercase T= to precede the string with a space (other function with Option: "u") | | optional |
p | Prefix | a prefix to be written in advance; e.g. p=<br/> for a new line | empty | optional |
l | Interwiki & interlanguage link | For interlanguage linking with ISO 639 codes if the file is in another Wikipedia and for Interwiki linking if the file is in a Wikimedia sister project, see parameter "l". | empty | optional |
lang | SVG language switch | language code (ISO 639), to display a translated version when the SVG file contains translations using SVG <switch> elements, see Parameter "lang". | empty | optional |
link | Link | enables to link to somewhere else | empty | optional |
by | Author | can be used to display the user who created the file, see parameter "by" | empty | optional |
m | Author modification code | modification of the "by"-user, e.g. c , d , n , t , w , wt ,see parameter "m" | empty | optional |
Template data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-specific information Establishes a link to the file whose name is given in parameter #1 and displays the name without the prefix "File:".
|
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Some templates using {{F}} can display an unlimited number of files, names and/or images, with possibly other display names and many other modifying parameters:
Other versions=
fieldThis template is not intended to be localized.
Parameter #1 (File Name) is the only parameter which is required. It can only hold the filename, with or without "File:", or "*" on the file description page – the displayed file name is without "File:". All underscores ("_") contained in the filename are replaced by spaces. Parameter values "Filename.ext" or "File:Filename.ext" may be used, but not "[[File:Filename.ext]]".
Parameter #2 (Display Name) can hold an alternate text (instead of the file name) which can only be passed with this parameter. Underscores ("_") contained in the display name are displayed. If there is no given alternate text parameter #2 can instead hold the first option.
Parameter #3 (Image size) can hold the displayed image size which can be passed with either 3=
ord=
. By default the image is displayed right of the file name; this can be changed to left with option "l" or to uppper with option "u". Formats for the image size are e.g. 96
orx64
or60x16
.
Syntax | Code example | Result | Note |
---|---|---|---|
{{ F | file name }} | {{F|SVG_Simple_Icon.svg}} {{F|File:SVG_Simple_Icon.svg}} |
SVG Simple Icon.svg | is the simplest form; it displays the file name as a link to the file. |
{{ F | file name | any text }} | {{F|SVG_Simple_Icon.svg|example}} |
example | displays the text string of the 2nd parameter as a link to the file. |
{{ F | file name | size }} | {{F|SVG_Simple_Icon.svg|d=16}} |
SVG Simple Icon.svg: ![]() |
displays first the file name, and then the image with a size in px. |
{{ F | file name | any text | size }} | {{F|Corsica-geographic map-fr.svg|Corsica|60x60}} |
Corsica: ![]() |
is the same but any text is displayed instead of the file name. |
Note:
{{PAGENAME}}
; this is possible only in the file
namespace.
Every one of these options can as well be specified with every parameter #4 to #7. When no display of the image is required, an option can also be specified with parameter #3; when parameter #2 is not needed for a display text, the option code can even be specified with parameter #2 (to distinguish a text of one character from a one-character-code, the text may need to be expanded e.g. with <nowiki/>).
{{ F | file name | any text | size | b | l | n }} is an example for usage of these formatting characters - the sequence does not matter.
There are the following options:
b
draws a border around the image. This can be useful to show the extensions of an image with transparency.Code | Result |
---|---|
{{F|Yes check.svg||60|b}}
|
Yes check.svg: ![]() |
l
displays the image left of the name. This option allows a better formatting, e.g. when more files are displayed in a list and the file names are of different length:{{F|file name|l|size}}
) to display the file left of the name.Code | Result |
---|---|
{{F|Kadro A4 001.svg||50|l}}
|
![]() |
c
displays the image in the center of the line (this option may collide with the File Function Letter "C", dependent on the other used parameters).Code | Result |
---|---|
{{F|Kadro A4 001.svg||50|c}}
|
Kadro A4 001.svg: ![]() |
r
displays the image to the right (has precedence over code l
). E.g.Code | Result |
---|---|
{{F|Kadro A4 001.svg||50|r|T= → → →}}
|
Kadro A4 001.svg → → →![]() |
u
: To show the file name below of ("under") the displayed picture, as with the [[File:...]] or the gallery function.Code | Result |
---|---|
{{F|Kadro A4 001.svg||80|u}}
|
{{ F | Solid orange.svg | u | 64 }}{{ F | Solid green.svg | u | 64 | t = 3 }}{{ Clr }}
Z
: When an image should be displayed without showing the file name, this can be achieved by setting the character "Z". Parameter #1 specifies the file name, parameter #3 the size; therefore Z
can be set by either parameter #4 to #7 or the not needed parameter #2. Of course it is of no use to combine Z
with n
, l
orr
but it won't do any harm.{{F|Rzz 10.svg|Z|10|b}}
{{F|Rzz 10.svg|b|16|Z}}
{{F|Rzz 10.svg||10|Z|b}}
will show n
: Independent whether the image is displayed or not, the parameter n
let display plain text instead of the link. This is sometimes useful for better formatting.n
can as well be specified with every parameter #4 to #7. When no display of the image is required, n
can also be specified with parameter #3; when parameter #2 is not needed for a display text, n
can even be specified with parameter #2 (to distinguish a text of one character from a one-character-code, the text may need to be expanded e.g. with <nowiki/>).+
: Independent whether the image is displayed or not, the plus sign can be used to prefix the file name display with the namespace.-
: With the minus sign the name space is not a part of the link:+
and a -
sign are mistakenly defined, the -
is ignored.+
or-
with n
are currently not working properly, esp. with n
as parameter #3. Use another, better working parameter sequence when a misinterpretion occurs.|11=baseline
or|14=text-bottom
.|12=border|13=center
Code | Result | Note |
---|---|---|
{{ F }} | 0 no name | without parameter #1: error display & categorization |
{{ F | Yes_check.svg }} | Yes check.svg | only link |
{{ F | Yes check.svg | n }} | Yes check.svg | only name - without link |
{{ F | Yes check.svg | 16 | b }} | Yes check.svg: ![]() |
bordered |
{{ F | Yes check.svg | 16 | l }} | ![]() |
left of name (as in "other versions" of File:Symbol unrelated.svg.) |
{{ F | Yes check.svg | 16 | n }} | Yes check.svg: ![]() |
no link (as in "other versions" of File:Arrow-C.svg.) |
{{ F | Yes check.svg | 16 | r }} | Yes check.svg: ![]() |
rightmost display, with file name |
{{ F | Yes check.svg | 16 | r | Z }} | ![]() |
rightmost display of image, without file name |
{{ F | Yes check.svg | 16 | c | Z }} | ![]() |
centered display of image, without file name |
Notes:
{{F|Yes check.svg||n}}
is equivalent to {{F|Yes check.svg|n}}
,{{F|Yes check.svg||16|b}}
is equivalent to {{F|Yes check.svg|b|16}}
{{F|Yes check.svg||16|r|Z}}
is equivalent to {{F|Yes check.svg|r|16|Z}}
and so on (Exception: {{F|Yes check.svg|c|16}}
is not working).{{F|X.jpg||16|b|l|n}}
is equivalent to {{F|X.jpg||16|n|l|b}}
.{{F|X.jpg||16|4=b|5=l}}
is equivalent to {{F|X.jpg||16|4=l|7=b}}
<nowiki />
.
t=
: When the image is displayed either left or right of the displayed file name, with t=
any text can be defined to separate the two items. It will replace the default separator :
(or
with option l
).
With the Option: u the parameter "t" can specify a pixel distance (left padding) making the display wider.
The named parameter l=
enables Interwiki access and interlanguage access.
Interwiki links or links to sister projects are e.g.
Interlanguage links are via ISO 639 codes
l=b:es
for an image of the Spanish Wikibooks{{F|Pallot1.svg|l=s:it}}
Pallot1.svg for an image of in Italian WikisourceNote:
The named parameter lang=
allows to use the language switch option:
The file France Population Pyramid-2010.svg contains many languages. With {{F|France Population Pyramid-2010.svg|Diagram rendered in {{#language:ru|en}}|250|l|lang=ru|t=<br />}}
the translated versions can be shown:
![]() Diagram rendered in Arabic |
![]() Diagram rendered in Japanese |
![]() Diagram rendered in Russian |
Note: The displayed names are linking to the default language version.
Code | Result |
---|---|
{{ F | Yes check.svg | b | 12 | by = Gmaxwell }} | Yes check.svg: ![]() |
{{ F | X mark.svg | - | by = {{ut|Anybody||de}} of {{wd}} }} | File:X mark.svg by Anybodyofde:Wp |
{{ F | #RR.svg | - | 22 | by = <>nobody }} | File:3RR.svg: ![]() |
{{ F | Yes check.svg | /Gmaxwell }} | Yes check.svg by Gmaxwell |
Note:
& ( . < [ {
are displayed-as-they-are without link, and & ( . <
doubled, or () <> [] {}
, are then removed.|by=
a|/
can be enough to specify a user. While By is used by several templates, the abbreviation "|/" is only possible with Template:F.|/
only /
is needed. Template:{{F}} avoids module invoked string operations which makes it necessary to use two parameters: filename.jpg|/username.
m=
: When a user name (e.g. of the creator) is displayed because of the parameter "by", any needed modification of {{U}} to either {{Ut}}, {{Uw}}or{{Uwt}} is possible with m=t
, m=w
, m=wt
.
Code | Result |
---|---|
{{ F | Yes check.svg | /Gmaxwell | m = t }} | Yes check.svg by Gmaxwell |
{{ F | Example.svg | by = Example | m = w }} | Example.svg by Example |
This option is completely different from the description above, a value is returned instead of displaying something. By invoking the Module:File various functions can be performed. While parameter #1 specifies the file, the File Function Letter
must be specified only with parameter #2 (or #1 when transcluded from the file page).
Such an FFL has precedence, additional parameter settings are ignored for most of the File Function Letters. Exception: "M".
Except of the mere string operations F
, X
and U
, for files outside the commons none of the File Functions can be performed.
FFL | Function | Returned result | Code example | Result |
---|---|---|---|---|
0F | file name | name without extension {{F|F}} | {{F|Peacedovei….svg|F}}
|
Peacedoveingreencircle |
0L | link name | name without extension but linked | {{F|Peacedovei….svg|L}}
|
Peacedoveingreencircle |
0M | file name | name stripped left and/or right | (only possible with the "M" as parameter 1) | - - - |
0X | extension | extension without name | {{F|Peacedovei….svg|X}} file
|
svg file |
{{uc:{{F|Peacedovei….svg|X}}}} file0Note: {{uc:}} forcing text string to uppercase.
|
SVG file | |||
0U | extension | extension as-it-is, case sensitive | {{F|Peacedovei….svg|U}} graphic
|
svg graphic |
0I | ifexist | "true" if file exists | {{F|Peacedovei….svg|I}}
|
true |
0C | count | number of file pages | {{F|Peacedovei….svg|C}}
|
1 |
0D | date | {{F|Peacedovei….svg|D}} |
- none - | |
0W | width | width in pixel | {{F|Peacedovei….svg|W}} ×{{F|Peacedovei….svg|H}} pixels
|
714 × 729 pixels |
0H | height | height in pixel | ||
0V | valid? | {{F|Peacedovei….svg|V}} |
- none - | |
0S | size | file size in bytes | {{F|Peacedovei….svg|S}} bytes
|
5819 bytes |
0P | page size | size of file description page in bytes | {{F|Peacedovei….svg|P}} bytes
|
2,448 bytes |
0G | gallery | gallery style display, see below | {{F|Peacedoveingreencircle.svg|G}}
|
Note:
|description={{en|{{F|F}}.}}
X
characters left with +X
, and/or of Y
characters right with -Y
, is possible with FFL "M":{{F|M|+5|-2}}
. See examples Gabjae Folk Museum 9.jpgorEquiangular pentagon 00.svg.{{F|*}}
- a short form of {{F|{{PAGENAME}}}}
.{{F|Buddhist rainbow flag.svg|Buddhist flag|32|l|t= file name: }} ({{uc:{{F|Buddhist rainbow flag.svg|X}}}} file, nominally {{F|Buddhist rainbow flag.svg|W}} × {{F|Buddhist rainbow flag.svg|H}} pixels, file size: {{F|Buddhist rainbow flag.svg|S}} bytes; description: {{F|Buddhist rainbow flag.svg|P}} bytes.)
gives the following:''{{subst:F|{{PAGENAME}}|F}}''
in the description of the above file will give: Buddhist rainbow flag; a short form can be used:With the File Function Letter "G" a gallery-like display can be achieved. Different possibilities exist:
Syntax | Code example | Result | Note |
---|---|---|---|
{{ F | file name | G }} | {{F|Sommet Grande tête….jpg|G}} |
no caption (like <gallery> file name </gallery> )
| |
{{ F | file name | 0 | G }} | {{F|Sommet Grande tête….jpg| |G}} |
||
{{ F | file name | caption | G }} | {{F|Sommet Grande tête….jpg|Sea of clouds|G}} |
|
with caption centered |
{{ F | file name | G | caption }} | {{F|Sommet Grande tête….jpg|G|Sea of clouds}} |
|
with caption left aligned (like <gallery> file name | caption </gallery>)
|
The minus sign can be used to display the name space "File:"
Syntax | Code example | Result | Note |
---|---|---|---|
{{ F | file name | -. | G }} | {{F|Birch in Kamikochi.jpg|-|G}} |
|
with caption of the full file name, centered |
{{ F | file name | G. | - }} | {{F|Birch in Kamikochi.jpg|G|-}} |
|
with caption of the full file name, left aligned (like <gallery> file name | File:file name </gallery>)
|
Notes:
|
(pipes).with Template:{{F}} | with Template:{{G}} | |
---|---|---|
|
{{G|Pink check.svg
| |
another example with caption: | ||
|
| |
|
|
![]() | Uses Lua:
|
With: {{ Iterate
| p1 = 32 | p2 = Z
| Pink check.svg |
| Purple check.svg |
| Yellow check.svg |
| White check.svg | b
| Red check.svg }}
(default for t=F
and n=2
)
these five files are shown:
With: {{ Filelist
| d = 32 | o = Z | c = n | q4 = b
| Pink check.svg
| Purple check.svg
| Yellow check.svg
| White check.svg
| Red check.svg }}
the same display is shown: