Template:Image: Difference between revisions

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
m (Testing...)
Line 4: Line 4:
       {{#if:{{{scale|}}}
       {{#if:{{{scale|}}}
         |{{ImageSize|File:{{{image|}}}|{{{scale|}}}}}
         |{{ImageSize|File:{{{image|}}}|{{{scale|}}}}}
         |{{Percent|{{{image|}}}|{{{size|}}}}}
         |[[File:{{{image|}}}|{{{scale|}}}]]
       }}
       }}
     }}<!--
     }}<!--

Revision as of 23:20, 22 February 2013


Purpose

This is a dynamic template that offers enhanced ways of handling images, including ways to:

  • Create captions for transparent images
  • Scale an image based on percentage instead of pixel amounts
  • Constrain an within specific dimensions
  • Create tooltips forimages with frames

None of these options are available or practical with standard image coding. This template allows for simplified ways of performing complex formatting of images.

Usage

To use this template, start with this code:

{{Image
|image        = 
|type         = 
|size         = 
|scale        = 
|align        = 
|caption      = 
|captionalign = 
|title        = 
|alt          = 
|link         = 
}}

Here are descriptions of the parameters. Only the parameter "image" is actually required, the rest are optional.

  • image — The desired image. Do not include a File prefix.
  • type — The type of display for the image. Choices are frameless, thumb, and caption. It defaults to caption if left blank. Frameless displays the image without any boxes or captions. Thumb displays the image in the traditional thumbnail box. Caption displays the image without any frame but with a boxed caption below it.
  • size — The size of the image. Enter as a pixel number followed by a px, or as a percentage number followed by a %.
  • scale — Use this if you instead wish to limit the overall size of the image to a certain pixel or percentage amount. Enter as a pixel number followed by a px, or as a percentage number followed by a %. This will keep the image's dimensions within the specified amount.
  • align — Set whether the image floats left or right. Defaults to left if not defined. Note that you can also use "position" as the name for this parameter.
  • caption — Caption to display under the image. Only displays for the thumb and caption types.
  • captionalign — Alignment of the text in the caption parameter. Options are: left, right, and center. Defaults to center.
  • title — The image's tooltip. Defaults to the caption.
  • alt — The text that is displayed when the image fails to load. Defaults to the file name.
  • link — The desired link. Can be internal or external. Defaults to the image's page if left blank. If you set this to "none", then the image will not create a link at all. Note: This only changes the image's link and it does not effect the enlarge link in image thumbnails.


Examples

Here is an example of some ways to use this template.

With standard sizing, the image is simply scaled to the width specified. An example code is:

Pixels
{{Image
|image    =Link YoungLink.png
|size     =100px
|link     =Link
|title    =Young Link
|align    =center
|type     =frameless
}}
Percentage
{{Image
|image    =Link YoungLink.png
|size     =25%
|link     =Link
|title    =Young Link
|align    =center
|type     =frameless
}}

This code is then shown rendered here, in a table for clarity:

Size
File:Link YoungLink.png
Young Link
Size
File:Link YoungLink.png
Young Link

With scale sizing, the image is constrained within a specific dimension. This can be used to ensure an image fits properly in a table. When used with a pixel amount, this is the exact same process that built-in image galleries use to maintain their structure with various image sizes. An example code is:

Pixels
{{Image
|image    =Link YoungLink.png
|scale    =100px
|link     =Link
|title    =Young Link
|align    =center
|type     =frameless
}}
Percentage
{{Image
|image    =Link YoungLink.png
|scale    =25%
|link     =Link
|title    =Young Link
|align    =center
|type     =frameless
}}

This code is then shown rendered here, in a table for clarity:

Scale
File:Link YoungLink.png
Young Link
Scale
File:Link YoungLink.png
Young Link

There is also the option of thumbnail and caption displays.

Thumbnail
{{Image
|image    =Link YoungLink.png
|type     =thumb
|scale    =100px
|link     =Link
|title    =Young Link
|align    =left
|caption  =Young Link
}}
Caption
{{Image
|image    =Link YoungLink.png
|scale    =100px
|link     =Link
|title    =Young Link
|align    =left
|caption  =Young Link
}}
File:Link YoungLink.png
Enlarge
Young Link
File:Link YoungLink.png
Young Link

Linking to nothing:

Caption
{{Image
|image    =Link YoungLink.png
|scale    =100px
|link     =none
|title    =Young Link
|align    =left
|caption  =Young Link
}}
Thumbnail
{{Image
|image    =Link YoungLink.png
|type     =thumb
|scale    =100px
|link     =none
|title    =Young Link
|align    =left
|caption  =Young Link
}}
Frameless
{{Image
|image    =Link YoungLink.png
|scale    =100px
|link     =none
|title    =Young Link
|align    =left
|caption  =Young Link
|type     =Frameless
}}
File:Link YoungLink.png
Young Link
File:Link YoungLink.png
Enlarge
Young Link
File:Link YoungLink.png
Young Link

Template:Cat