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

From Kerbal Space Program Wiki
Jump to: navigation, search
(Add doc)
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 +
{{En-WP attribution notice}}
 
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE -->
  
Line 6: Line 7:
 
With the appropriate choice of parameters, the template can automatically resize images to a given total width with each image having the same height.
 
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: {{tq|"'''Except with very good reason, do not use''' <code>px</code>"... "'''which forces a fixed image width.''' In most cases {{nobr|1=<code>upright=''scaling factor''</code>}} should be used, thereby respecting the user's base preference (which may have been selected for that user's particular devices)."}})
+
'''Be aware''' that this template does ''not'' respect users' default image size preferences. ([[w:Wikipedia:Image use policy]] states: {{tq|"'''Except with very good reason, do not use''' <code>px</code>"... "'''which forces a fixed image width.''' In most cases {{nobr|1=<code>upright=''scaling factor''</code>}} 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.
 
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.
Line 14: Line 15:
 
Note the different meanings of the ''width[n]'' parameters with vs. without 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
 
;No automatic resizing of all images to the same height
:<source lang="xml">
+
 
 +
<pre>
 
{{multiple image
 
{{multiple image
 
<!-- Layout parameters -->
 
<!-- Layout parameters -->
Line 22: Line 24:
 
  | width            = <!-- displayed width of each image in pixels (an integer, omit "px" suffix); overrides "width[n]"s below -->
 
  | width            = <!-- displayed width of each image in pixels (an integer, omit "px" suffix); overrides "width[n]"s below -->
 
  | caption_align    = <!-- left (default), center, right -->  
 
  | caption_align    = <!-- left (default), center, right -->  
 
 
<!-- Header -->
 
<!-- Header -->
 
  | header_background =  
 
  | header_background =  
 
  | header_align      = <!-- center (default), left, right -->
 
  | header_align      = <!-- center (default), left, right -->
 
  | header            =  
 
  | header            =  
 
 
<!--image 1-->
 
<!--image 1-->
 
  | image1            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
 
  | image1            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
Line 43: Line 43:
 
  | caption2          =  
 
  | caption2          =  
 
<!-- and so on, to a maximum of 10 images (image10) -->
 
<!-- and so on, to a maximum of 10 images (image10) -->
 
 
<!-- Footer -->
 
<!-- Footer -->
 
  | footer_background =  
 
  | footer_background =  
Line 49: Line 48:
 
  | footer            =  
 
  | footer            =  
 
}}
 
}}
</source>
+
</pre>
  
 
;Automatic resizing of all images to the same height and to a given total width
 
;Automatic resizing of all images to the same height and to a given total width
:<source lang="xml">
+
 
 +
<pre>
 
{{multiple image
 
{{multiple image
 
<!-- Layout parameters -->
 
<!-- Layout parameters -->
Line 60: Line 60:
 
  | total_width      = <!-- total width of all the displayed images in pixels (an integer, omit "px" suffix) -->
 
  | total_width      = <!-- total width of all the displayed images in pixels (an integer, omit "px" suffix) -->
 
  | caption_align    = <!-- left (default), center, right -->  
 
  | caption_align    = <!-- left (default), center, right -->  
 
 
<!-- Header -->
 
<!-- Header -->
 
  | header_background =  
 
  | header_background =  
 
  | header_align      = <!-- center (default), left, right -->
 
  | header_align      = <!-- center (default), left, right -->
 
  | header            =  
 
  | header            =  
 
 
<!--image 1-->
 
<!--image 1-->
 
  | image1            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
 
  | image1            = <!-- filename only, i.e. without "File:" or "Image:" prefix -->
Line 79: Line 77:
 
  | caption2          =  
 
  | caption2          =  
 
<!-- and so on, to a maximum of 10 images (image10) -->
 
<!-- and so on, to a maximum of 10 images (image10) -->
 
 
<!-- Footer -->
 
<!-- Footer -->
 
  | footer_background =  
 
  | footer_background =  
Line 85: Line 82:
 
  | footer            =  
 
  | footer            =  
 
}}
 
}}
</source>
+
</pre>
  
 
{| class=wikitable
 
{| class=wikitable
Line 94: Line 91:
 
| direction      || horizontal ''(default)'', vertical
 
| direction      || horizontal ''(default)'', vertical
 
|-
 
|-
| background color || To set [[List of colors|the background color]] of the box in which the images appear.
+
| background color || To set [[w:List of colors|the background color]] of the box in which the images appear.
 
|-
 
|-
 
| header_background ||  
 
| header_background ||  
Line 112: Line 109:
 
| height''[n]''  || ''(as above)''&nbsp; The full height of the original [n]th image if {{mono|total_width}} is given in order to resize all images to the same height and a given total width. Ignored otherwise.
 
| height''[n]''  || ''(as above)''&nbsp; The full height of the original [n]th image if {{mono|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)''&nbsp; [[WP:ALT|Alt description]] for [n]th image.
+
| alt''[n]''    || ''(as above)''&nbsp; [[w:WP:ALT|Alt description]] for [n]th image.
 
|-
 
|-
| link''[n]''    || ''(as above)''&nbsp; 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. {{mono|<nowiki>...|alt1=... |link1= |caption1=...</nowiki>}}), linking is disabled (even to [[Image description page|the standard Wikipedia image description page]]); consider [[WP:ALT]].<br />'''''Note:''''' This parameter '''''must not''''' be used with images that have been given [[free license]]s (such as the [[GNU Free Documentation License|GDFL]] or a free [[Creative Commons license|CC license]]) as these licenses require images to be linked to a declaration of the license under which they are being used.
+
| link''[n]''    || ''(as above)''&nbsp; 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. {{mono|<nowiki>...|alt1=... |link1= |caption1=...</nowiki>}}), linking is disabled (even to [[w:Image description page|the standard Wikipedia image description page]]); consider [[w:WP:ALT]].<br />'''''Note:''''' This parameter '''''must not''''' be used with images that have been given [[w:free license]]s (such as the [[w:GNU Free Documentation License|GDFL]] or a free [[w:Creative Commons license|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)''&nbsp; 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]].
 
| thumbtime''[n]'' || ''(as above)''&nbsp; 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]].
Line 132: 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 141: 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.
Line 152: Line 149:
 
=== More examples ===
 
=== More examples ===
 
For more examples see the [https://en.wikipedia.org/wiki/Template:Multiple_image/doc#Examples Wikipedia] page.
 
For more examples see the [https://en.wikipedia.org/wiki/Template:Multiple_image/doc#Examples Wikipedia] page.
 
== Tracking categories ==
 
* {{clc|Pages using multiple image with auto scaled images}}
 
* {{clc|Pages using multiple image with manual scaled images}}
 
 
== See als o==
 
* {{tl|Gallery}}
 
* {{tl|Image array}}
 
* {{tl|Image frame}}
 
* {{tl|Photomontage}}
 
  
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |

Latest revision as of 12:12, 7 March 2020

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. (w: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 w:WP:ALT.
Note: This parameter must not be used with images that have been given w: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.