Difference between revisions of "Template:Multiple image/doc"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (Fixes)
m
Line 129: Line 129:
 
{{multiple image
 
{{multiple image
 
  | width = 60
 
  | width = 60
  | image1 = Yellow card.svg
+
  | image1 = Yellow card.png
 
  | alt1 = Yellow cartouche
 
  | alt1 = Yellow cartouche
  | image2 = Red card.svg
+
  | image2 = Red card.png
 
  | alt2 = Red cartouche
 
  | alt2 = Red cartouche
 
  | footer = Players are cautioned with a yellow card and sent off with a red card.
 
  | footer = Players are cautioned with a yellow card and sent off with a red card.
Line 138: Line 138:
 
{{multiple image
 
{{multiple image
 
  | width = 60
 
  | width = 60
  | image1 = Yellow card.svg
+
  | image1 = Yellow card.png
 
  | alt1 = Yellow cartouche
 
  | alt1 = Yellow cartouche
  | image2 = Red card.svg
+
  | image2 = Red card.png
 
  | alt2 = Red cartouche
 
  | alt2 = Red cartouche
 
  | footer = Players are cautioned with a yellow card and sent off with a red card.
 
  | footer = Players are cautioned with a yellow card and sent off with a red card.

Revision as of 22:40, 14 April 2018

This template creates a box containing between two and ten images, arranged either vertically or horizontally and with captions for the entire box or per image.

With the appropriate choice of parameters, the template can automatically resize images to a given total width with each image having the same height.

Be aware that this template does not respect users' default image size preferences. (Wikipedia:Image use policy states: "Except with very good reason, do not use px"... "which forces a fixed image width. In most cases Template:Nobr should be used, thereby respecting the user's base preference (which may have been selected for that user's particular devices).")

If image size parameters are omitted, this template sets all images at 200px wide, regardless of whether the reader has set a preference for some other default image width. This causes multiple images to look out of scale to the other images in an article.

Syntax and parameters

Provide height[n] and total_width parameters to obtain automatic resizing. Note the different meanings of the width[n] parameters with vs. without automatic resizing.

No automatic resizing of all images to the same height
{{multiple image
<!-- Layout parameters -->
 | align             = <!-- right (default), left, center, none --> 
 | direction         = <!-- horizontal (default), vertical -->
 | background color  = <!-- box background -->
 | width             = <!-- displayed width of each image in pixels (an integer, omit "px" suffix); overrides "width[n]"s below -->
 | caption_align     = <!-- left (default), center, right --> 
<!-- Header -->
 | header_background = 
 | header_align      = <!-- center (default), left, right -->
 | header            = 
<!--image 1-->
 | image1            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
 | width1            = <!-- displayed width of image; overridden by "width" above -->
 | alt1              = 
 | link1             = 
 | thumbtime1        =
 | caption1          = 
<!--image 2-->
 | image2            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
 | width2            = <!-- displayed width of image; overridden by "width" above -->
 | alt2              = 
 | link2             = 
 | thumbtime2        =
 | caption2          = 
<!-- and so on, to a maximum of 10 images (image10) -->
<!-- Footer -->
 | footer_background = 
 | footer_align      = <!-- left (default), center, right -->
 | footer            = 
}}
Automatic resizing of all images to the same height and to a given total width
{{multiple image
<!-- Layout parameters -->
 | align             = <!-- right (default), left, center, none --> 
 | direction         = <!-- horizontal (default), vertical -->
 | background color  = <!-- box background -->
 | total_width       = <!-- total width of all the displayed images in pixels (an integer, omit "px" suffix) -->
 | caption_align     = <!-- left (default), center, right --> 
<!-- Header -->
 | header_background = 
 | header_align      = <!-- center (default), left, right -->
 | header            = 
<!--image 1-->
 | image1            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
 | alt1              = 
 | link1             = 
 | thumbtime1        =
 | caption1          = 
<!--image 2-->
 | image2            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
 | alt2              = 
 | link2             = 
 | thumbtime2        =
 | caption2          = 
<!-- and so on, to a maximum of 10 images (image10) -->
<!-- Footer -->
 | footer_background = 
 | footer_align      = <!-- left (default), center, right -->
 | footer            = 
}}
Parameter Description
align right (default), left, center
direction horizontal (default), vertical
background color To set the background color of the box in which the images appear.
header_background
header_align center (default), left, right
header
width Use to set the same width for each image (i.e. overrides any width[n] below). Do not include if different image widths intended, including if images are to be resized to a fixed total width.
total_width Use to scale the images to the same height and this total width. Do not use both total_width and width.
image[n] (where [n] = 1 to 10)  Filename of [n]th image.
width[n] (as above)  Two meanings: (1) The width (in pixels, integer, omit "px") of [n]th image. Overridden by width (if set). (2) The full width of the original [n]th image if total_width is given in order to resize all images to the same height and a given total width.
height[n] (as above)  The full height of the original [n]th image if total_width is given in order to resize all images to the same height and a given total width. Ignored otherwise.
alt[n] (as above)  Alt description for [n]th image.
link[n] (as above)  To specify the page to which the [n]th image is linked (i.e. the page that is loaded when the image is clicked). If set as empty (e.g. ...|alt1=... |link1= |caption1=...), linking is disabled (even to the standard Wikipedia image description page); consider WP:ALT.
Note: This parameter must not be used with images that have been given free licenses (such as the GDFL or a free CC license) as these licenses require images to be linked to a declaration of the license under which they are being used.
thumbtime[n] (as above)  When using Ogg Theora files, sets the time within the video that is used for the initial display. This is either a number of seconds or hours:minutes:seconds; see commons:Commons:Video#Setting a video thumbnail image.
caption[n] (as above)  Caption for the [n]th image.
caption_align left (default), center, right
footer_background
footer_align left (default), center, right
footer Caption that spans the entire box, as opposed to individual images. Avoid "left" and "right" if possible, since mobile devices may display the images vertically.

Examples

Yellow cartouche
Red cartouche
Players are cautioned with a yellow card and sent off with a red card.
{{multiple image
 | width = 60
 | image1 = Yellow card.png
 | alt1 = Yellow cartouche
 | image2 = Red card.png
 | alt2 = Red cartouche
 | footer = Players are cautioned with a yellow card and sent off with a red card.
}}

More examples

For more examples see the Wikipedia page.