Template:Image

From Terraria Wiki
Jump to navigation Jump to search
This template uses the Cargo extension.
This template uses Extension:Cargo, an integral part of the wiki's back-end.
  • This template defines the table "Imageinfo". View table.
Important.svg
CAUTION: Terraria Wiki code is complex!!!
If you want to use this code on another wiki, wiki.gg staff are not able to assist you.
Please consider picking a different wiki to adapt code from, or making your own templates!
Remember that content on a wiki is more important than fancy formatting.
Template-info.svg Documentation The documentation below is transcluded from Template:Image/doc. (edit | history)

This template "safely" displays an image, meaning that no red link will be produced if the image doesn't exist.

Additionally, omitting the file extension causes the template to automatically check if a GIF file with the provided name exists and display that if it does. If no GIF file exists, the template falls back to the PNG file, again checking if it exists and only displaying that if it does.

Usage

{{ image | <file name> | <[[File:]] syntax options> | size = <image size> | scale = <image scaling factor> | maxsize = <image size limit> | redlink = y/yes }}

First unnamed parameter

Name of the file, with or without file extension.

[[File:]] syntax options

All parameters of the regular [[File:]] syntax can be used, like caption and link.

size

Overrides the size option from the [[File:]] syntax. A scaling factor can be appended with an asterisk. For instance, with |20px|size=40px*0.75 the 20px from the [[File:]] syntax will be ignored and the 40px*0.75 will be interpreted as 30px.

scale

Scales the image based on its size, e.g. scale=0.5 halves the image size.

maxsize

Uses the same syntax as the size option from the [[File:]] syntax: <width>px, <height>px, or <width>x<height>px. Note: this is applied after scaling.

redlink

For files that do not exist, this template outputs nothing by default. If this parameter is set, this template will produce a red link for the file.

Examples

Code Result
{{image|Wood}} Wood.png
{{image|Soul of Light}} Soul of Light.gif
{{image|Soul of Light.png}} Soul of Light.png
{{image|Nonexistent image}}