Template:Img/doc

From Immortal Life Wiki
Jump to navigation Jump to search

Description

This template is a wrapper for Module:ImageUnifier and all the functionality happens there. It is designed to give all various image templates some common functionality. While this template can be called directly from main pages, it was designed to be called from other templates that need to display an image.

Syntax

{{img|<1>|<2>|<3>|size=|caption=|options=|<...=>}}
<1> <2> <3> etc.
Required: Image file names, if no valid extension is present, then .png will be assumed. Any number of image files can be passed in, but they will all use the same named parameters.
size
Optional: Size of the image file as seen in size groups. As mentioned, any existing hardcoded sizes (ie: 30px) will be converted to the closest matching size group. If size is not present, then the image will be displayed at full size.
  • If manual sizing is absolutely required, then the size can be overridden by adding an 'o' at the end of the pixel size. (ie: 30pxo)
caption
Optional: Named parameter caption field is a passthrough for the non-named caption field used in File:Image.
options
Optional: All other non-named parameters from File:Image, such as format, horizontal alignment, and vertical alignment, can be added to options as a comma separated list. (ie: options=thumb,right)
All other named parameters
Optional: All other named parameters will be passed on directly to the File:Image wikicode.

Samples

*Icon inline with text 2{{img|Spirit Stone|size=text|caption=Spirit Stone|link=Spirit Stone}}
*Multiple Crops {{img|Anima Fruit|Potato|Cabbage|size=text|caption=Crops|link=:Category:Crops}}
*3 different sizes become the same size
{{img|Anima Herb|size=36px}}
{{img|Anima Herb|size=medium}}
{{img|Anima Herb|size=55x55px}}
*thumbnail of a jpg screenshot with size override
{{img|Main Hall.png|size=x120pxo|options=thumb,left|caption=Main Hall}}

Results in...

  • Icon inline with text 2Spirit Stone
  • Multiple Crops CropsCropsCrops
  • 3 different sizes become the same size

Anima Herb.png Anima Herb.png Anima Herb.png

  • thumbnail of a jpg screenshot with size override
Main Hall

Features

Size groups

Throughout this wiki, images were being displayed in multiple different sizes that were hardcoded. This goes against general ideas of css styling to have consistency for how things should be displayed.

This template uses a standard set of size groups for its images.

text
Text sized images are designed to be display inline with text. Any image that is currently coded to be less than 36px in size will automatically be converted to this size group. There are default stylings that can be overridden on an image by image basis to give the following features.
  • Default height of 26px; designed to be as big as possible without offsetting line heights noticeably.
  • Adjusts the vertical positioning so the images appear level with text.
  • Create a uniform horizontal padding between images and text, ideally around 3 pixels.
  • Prevent word wrapping from happening between images and text without a space character between them.
header
Header sized (h2 and h3) images are designed to be displayed inline with headers. Default height of 40px.
small
Small images are designed to be displayed as small icons without the extra inline text features. Default height of 30px.
medium
Medium images are designed to be displayed as normal icons. Any image that is currently coded to be less than 56px in size will automatically be converted to medium. Default height of 50px.
large
Large images are designed to be displayed as large icons. Any image that is currently coded to be less than 81px in size will automatically be converted to large. Default height of 75px.


If absolutely necessary a manual pixel size can be supplied by overriding the size groups. To do so just add an "o" after the "px" (ie: 34pxo).