Template:Double 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
MOS:IMGSIZE states that a fixed width in pixels may only be specified, px
"... "which forces a fixed image width.""Where absolutely necessary."
)
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.
Please also note the option to set a |total_width=
parameter at the beginning of the {{multiple image}} template.
- Automatic resizing of all images to the same height and to a given total width
{{Multiple image|total_width = 600 <!-- Layout parameters --> | align = <!-- right (default), left, center, none --> | direction = <!-- horizontal (default), vertical --> | background color = <!-- box background as a 'hex triplet' web color prefixed by # e.g. #33CC00 --> | width = <!-- displayed width of each image in pixels (an integer, omit "px" suffix); overrides "width[n]"s below --> | caption_align = <!-- left (default), center, right --> | image_style = <!-- border:1; (default) --> | image_gap = <!-- 5 (default)--> <!-- Header --> | header_background = <!-- header background as a 'hex triplet' web color prefixed by # e.g. #33CC00 --> | header_align = <!-- center (default), left, right --> | header = <!-- header text --> <!--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 --> <!-- Footer --> | footer_background = <!-- footer background as a 'hex triplet' web color prefixed by # e.g. #33CC00 --> | footer_align = <!-- left (default), center, right --> | footer = <!-- footer text --> }}
- 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 --> | 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 --> <!-- 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) The page linked to the [n]th image (i.e. the page that is loaded when the image is clicked).
|
thumbtime[n] | (as above) When using video 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
{{multiple image
| width = 60
| image1 = Yellow card.svg
| alt1 = Yellow cartouche
| image2 = Red card.svg
| alt2 = Red cartouche
| footer = Players are cautioned with a yellow card and sent off with a red card.
}}
{{multiple image
| align = left
| direction = vertical
| width = 200
| header = [[Portable Network Graphics|PNG]] transparency demonstration
| image1 = PNG transparency demonstration 1.png
| alt1 = Colored dice with white background
| caption1 = A PNG image with an 8-bit transparency layer...
| image2 = PNG transparency demonstration 2.png
| alt2 = Colored dice with checkered background
| caption2 = ...here overlaying a checkered background.
}}
{{multiple image
| width = 60
| image1=Ribbon numeral 2.png | alt1=2
| image2=Ribbon numeral 3.png | alt2=3
| image3=Ribbon numeral 4.png | alt3=4
| footer = When a user has many of one type of [[WP:BARN|barnstar]], they can represent them with [[WP:RIBBON|ribbons]] and these numerals to indicate the count.
}}
With background color
{{multiple image
| align = left
| background color = #BBDD99
| width = 160
| image1 = Adoxa_moschatellina_210406.jpg
| alt1 = Green herb with a few tiny yellow-white flowers
| image2 = Adoxa_moschatellina_210406a.jpg
| alt2 = Three small white and yellow flowers before green-leaf background
| image3 = adoxa_moschatellina_blatt.jpeg
| alt3 = Leaves of a plant, in groups of three each with three lobes
| footer_background = #33CC00
| footer_align = center
| footer = ''[[Adoxa]]'' (''Adoxa moschatellina'')
}}
If the images have a clear background, this will by default be changed to white. To make the background color of the images match, set them with |image_style=background-color:
. You might want to also remove the border.
{{multiple image
| align = center
| width = 64
| background color = black
| image_style=background-color:black; border:none;
| image1 = Aries symbol (planetary color).svg|link1=Aries (astrology)
| image2 = Taurus symbol (planetary color).svg|link2=Taurus (astrology)
| image3 = Gemini symbol (planetary color).svg|link3=Gemini (astrology)
| image4 = Leo symbol (planetary color).svg|link4=Leo (astrology)
}}