Template:FreedImg/doc
Template:Documentation subpage Template:Uses TemplateStyles Template:Lua
- Use this image container template to display CENTERED images.
- Resizes the container dynamically and provides additional image related features.
- When used to display an offset image, the surrounding text is broken into a new paragraph.
Usage
- Always please use the shortcut to FreedImg, Template:Tl, rather than the long template name.
{{FI
| type =
| file =
| width =
| imgwidth =
| cclass =
| cstyle =
| float =
| margin-left =
| margin-right =
| clear =
| caption =
| top-caption =
| tmleft =
| indent =
| tstyle =
| talign =
| alt =
| link =
| page =
| night-mode-invert =
}}
For true inline usage, please see FreedImg/span, Template:Tl, instead.
Parameters
- For the Image itself
- mandatory Template:Parameter: File name (without the "File:" prefix).
- optional Template:Parameter: Image alt-text, ie. for mouse-over text box or for use with a screenreader for the visually impaired.
- optional Template:Parameter: Override the default image link with an internal/external URL of your choosing (optional)
- optional Template:Parameter: Select individual image page within a multi-page file (PDF/DJVU etc.; optional)
- optional Template:Parameter: Set to
trueif the image should be inverted on night mode- for example, set to
truefor a black line drawing on a transparent background
- for example, set to
- when the (Template:Parameter=user) is present & set
- Images generated by certain wikicode extensions (e.g. the default <math> User preference, <score>, etc.) may be entered in the named Template:Parameter parameter instead.
- Primary DIV container
- Template:Parameter: The width of the primary container, by percentage (present, variable, default 100%)
- Template:Parameter: The class for the primary container, (present, variable, default floatnone [a null undefined classname just for placeholder purposes])
- Template:Parameter: Any special overall styles to apply to primary container (default: no extra CSS).
- Template:Parameter: The alignment of the primary container (not present; must be added, options are "left" or "right"; otherwise remains centered).
- Template:Parameter: The margin(s) of the primary container to be cleared (not present; must be added, options are "left", "right" or "both").
- Template:Parameter, Template:Parameter : Any special margins to be applied to the primary container (defaults appropriate for centered result).
- Image element
- Template:Parameter: extra CSS classes to add
- Template:Parameter: request this size of image from the server, rather than computing a guess. This can help to reduce file size, for example, when you know the image will be used in a narrow container. If Template:Parameter is given and uses
px, you don't need to repeat it here. This value must be a pixel based value (em or percent based values are not supported for this parameter).
- Image Caption
- Template:Parameter: The bottom image caption (if present)
- Template:Parameter: The top image caption (if present)
- Template:Parameter, Template:Parameter: Any special text style or alignment to apply to caption block (if present).
- Template:Parameter, Template:Parameter: Any special text-flow (e.g. hanging indent etc.) control to apply to caption (if present).
Styling via CSS
The following classes are applied, which can be targeted with work-specific CSS:
- The whole container:
wst-freedimgTemplate:Smaller - The caption(s):
wst-freedimg-captionTemplate:Smaller- The top caption:
wst-freedimg-caption-topTemplate:Smaller - The top caption:
wst-freedimg-caption-bottomTemplate:Smaller
- The top caption:
Examples
Basic example: centred image
Musical score
Mathematical Equation
Page of a multipage document
Adding classes to the image (e.g. rotation)
{{FI
| file = Iceberg.jpg
| width = 20%
| link = w:Iceberg{{!}}Iceberg article at Wikipedia
| alt = WS Iceberg
| imgclass = rot270
| caption = Gravity right
}}
|
{{FI
| file = Iceberg.jpg
| width = 40%
| link = w:Iceberg{{!}}Iceberg article at Wikipedia
| alt = WS Iceberg
| imgclass = rot90
| caption = Gravity left
}}
| |||
| Template:FI | Template:FI | |||
| Template:FI | ||||
{{FI
| file = Iceberg.jpg
| width = 40%
| link = w:Iceberg{{!}}Iceberg article at Wikipedia
| alt = WS Iceberg
| imgclass = rot180
| caption = Gravity up
}}
| ||||
Extra CSS styles
Missing images
If an image doesn't exist yet, you can use missing in the Template:Parameter parameter:
Night mode inversion
See also
- Template for offset images Template:FreedImg/span aka Template:Tl
<templatedata>
{
"params": {
"type": {
"label": "type",
"description": "Type of content",
"type": "string",
"suggestedvalues": [
"math",
"score",
"missing"
],
"suggested": true
},
"file": {
"label": "file",
"description": "filename of image to float.",
"type": "string"
},
"alt": {},
"link": {},
"page": {
"label": "page",
"description": "Page number to use when the filename is a multi page document (such as PDF/DJVU).",
"type": "number"
},
"width": {},
"cclass": {},
"cstyle": {},
"float": {},
"clear": {},
"margin-left": {},
"margin-right": {},
"imgclass": {},
"imgwidth": {},
"caption": {},
"top-caption": {},
"tstyle": {},
"talign": {},
"tmleft": {},
"indent": {},
"night-mode-invert": {
"description": "Whether the image should be inverted for night mode",
"type": "boolean",
"autovalue": "false"
}
},
"description": "Floats an image/caption block.",
"paramOrder": [
"type",
"file",
"alt",
"link",
"page",
"width",
"cclass",
"cstyle",
"float",
"clear",
"margin-left",
"margin-right",
"imgclass",
"imgwidth",
"caption",
"top-caption",
"tstyle",
"talign",
"tmleft",
"indent",
"night-mode-invert"
],
"format": "block"
}
</templatedata>