Template:Multiple image
From Iwe
Template:Permanently protected Template:Talk header User:ClueBot III/ArchiveThis
Transparancy
This template replaces a transparent background with white. This is not desired, because the default background is gray so it shows a border that does not really exists. Can this be disabled so it shows the same color? I can hack around it by changing the entire background to white, but I would prefer not having to do this. PhotographyEdits (talk) 13:26, 12 December 2022 (UTC)
- I see this was from a while ago, but if you're still struggling with this - try setting "image_style=background-color:yourcolorhere; border:none;". This is taken from the "with background color" section, specifically the part with the astrology symbols. (Or, even if you have figured this out, I suppose this might be helpful for anyone else looking). AnteaterStim (talk) 19:40, 8 August 2023 (UTC)
Issues with Vector 2022
Hi, this template works perfectly fine in the normal Vector version, but in Vector 2022, the center-aligned option creates large blank spaces in articles when there is an infobox to the right of the template. See Incheon Station and Napier MRT station, for example. Is this a fixable issue? Pinging @Frietjes and @Thumperward as I've seen you've edited this template in the past. :3 F4U (they/it) 23:32, 13 July 2023 (UTC)
- I don't think there is anything special about Vector2022, centered multiple images, or infoboxes here except that these tend to make narrow margins, wide floating content, and wide non-floating content. This is just a MOS:SANDWICH issue: to avoid badness caused by wide floats (the infobox) and wide content elements (the centered image) being unable to fit side-by-side in narrow margins, don't write the article in a way that causes them to be side-by-side. —David Eppstein (talk) 00:57, 14 July 2023 (UTC)
- Hmmm I think I get what you're saying, lemme do a thing. :3 F4U (they/it) 00:58, 14 July 2023 (UTC)
- One way to check this is to make your browser window very narrow. When I do this in monobook on Incheon Station I get the same effect that I would with the narrower margins of Vector2022 on a wider window. —David Eppstein (talk) 01:00, 14 July 2023 (UTC)
- I find that using Template:Tag or {{gallery}} with Template:Para is a better option in these cases. Frietjes (talk) 15:13, 14 July 2023 (UTC)
- One way to check this is to make your browser window very narrow. When I do this in monobook on Incheon Station I get the same effect that I would with the narrower margins of Vector2022 on a wider window. —David Eppstein (talk) 01:00, 14 July 2023 (UTC)
- Hmmm I think I get what you're saying, lemme do a thing. :3 F4U (they/it) 00:58, 14 July 2023 (UTC)
Is there an option to add footers between rows of images?
I want to add footers in this template between each row of images instead of just one footer at the bottom; is this currently possible?
I don't see parameters like footer1 or footer2 in the documentation, so I wonder if there's another way to do this. Jarble (talk) 20:43, 17 July 2023 (UTC)
I can do this using an image frame, but the captions are too small: Template:Image frame
But the captions display normally when I use this template outside the frame: {{#ifeq: multiple image | doc
|
{{
#ifeq: show | show| {{#ifeq:|yes||
| {{{topimage}}}{{#if: | {{{topcaption}}} }} |
| {{{pretitle}}} |
| }}Message box meta-templates |
|---|
| {{{image}}}{{#if: | {{{caption}}} }} |
| {{{above}}} |
| {{{heading1}}} |
|
| {{{heading2}}} |
| {{{content2}}} |
| {{{heading3}}} |
| {{{content3}}} |
| {{{heading4}}} |
| {{{heading5}}} |
| {{{content5}}} |
| {{{heading6}}} |
| {{{content6}}} |
| {{{heading7}}} |
| {{{content7}}} |
| {{{heading8}}} |
| {{{content8}}} |
| {{{heading9}}} |
| {{{content9}}} |
| {{{heading10}}} |
| {{{content10}}} |
| {{{heading11}}} |
| {{{content11}}} |
| {{{heading12}}} |
| {{{content12}}} |
| {{{heading13}}} |
| {{{content13}}} |
| {{{heading14}}} |
| {{{content14}}} |
| {{{heading15}}} |
| {{{content15}}} |
| {{{heading16}}} |
| {{{content16}}} |
| {{{heading17}}} |
| {{{content17}}} |
| {{{heading18}}} |
| {{{content18}}} |
| {{{heading19}}} |
| {{{content19}}} |
| {{{heading20}}} |
| {{{content20}}} |
| {{{heading21}}} |
| {{{content21}}} |
| {{{heading22}}} |
| {{{content22}}} |
| {{{heading23}}} |
| {{{content23}}} |
| {{{heading24}}} |
| {{{content24}}} |
| {{{heading25}}} |
| {{{content25}}} |
| {{{heading26}}} |
| {{{content26}}} |
| {{{heading27}}} |
| {{{content27}}} |
| {{{heading28}}} |
| {{{content28}}} |
| {{{heading29}}} |
| {{{content29}}} |
| {{{heading30}}} |
| {{{content30}}} |
| {{{heading31}}} |
| {{{content31}}} |
| {{{heading32}}} |
| {{{content32}}} |
| {{{heading33}}} |
| {{{content33}}} |
| {{{heading34}}} |
| {{{content34}}} |
| {{{heading35}}} |
| {{{content35}}} |
| {{{below}}} |
| {{#switch: mbox templates
|table={ class="wikitable" !Comenius OSM and Tourism !Sl: Life Long Learning Mapping Project !Ro: Life Long Learning Mapping Project !Pt:Life Long Learning Mapping Project !Tr: Life Long Learning Mapping Project !DE: Life Long Learning Mapping Project } |line=Comenius - To boost local and international tourism with OpenStreetMap - BoostOSM
{ class="center" - style="width:16%;vertical-align:bottom;" File:Merge.png } |small=Template:Navigation bar | #default =Template:Navigation bar }}
|
}}{{
#if:
|
| {{#ifexist:Template:Multiple image|[[Category:{{
#switch: Template
| Template = Template
| User = User
| #default = Wikipedia
}} documentation pages]]|}}
}}
| }} Template:Lua
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: Template:Tq)
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
- <source lang="xml">
Template loop detected: Template:Multiple image </source>
- Automatic resizing of all images to the same height and to a given total width
- <source lang="xml">
Template loop detected: Template:Multiple image </source>
| 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 Template:Mono 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 Template:Mono and Template:Mono. |
| 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 Template:Mono (if set). (2) The full width of the original [n]th image if Template:Mono 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 Template:Mono 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. Template:Mono), 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
Template loop detected: Template:Multiple image
{{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.
}}
Template loop detected: Template:Multiple image
{{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.
}}
Template loop detected: Template:Multiple image
{{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.
}}
Template:Clear right
With background color
Template loop detected: Template:Multiple image
<source lang="moin" style="overflow:auto;"> Template loop detected: Template:Multiple image </source>
With links (link[n])
Template loop detected: Template:Multiple image Template:Clear left <source lang="moin" style="overflow:auto;"> Template loop detected: Template:Multiple image </source>Template:Clear right
Using direction
By default, the images the template presents are displayed horizontally, as a row (see left; equivalent to setting Template:Mono). To display them vertically, i.e. as a column, set Template:Mono (see right). Template loop detected: Template:Multiple image Template loop detected: Template:Multiple image
On mobile devices some images may always be displayed vertically if the total width is larger than around 320.
To match image heights
- Decide on a total width for all the images, say 320px
- Set the total width using Template:Para
Template loop detected: Template:Multiple image
{{multiple image
| align = right
| total_width = 320
| image1 = Donkey 1 arp 750px.jpg
| alt1 = A donkey
| caption1 = Rectangular image of a donkey, originally 536 pixels high.
| image2 = Rainbow_trout.png
| alt2 = A trout
| caption2 = Square image of a trout, originally 300 pixels high.
| footer = Both images have been rendered with the same height, and a total width of 320px
}}
The aspect ratio of each image is automatically retrieved from the File metadata. You can override the native width and height values by
- Examining the individual image pages to obtain the full resolution. For example:
- File:Donkey 1 arp 750px.jpg shows "Donkey_1_arp_750px.jpg (750 × 536 pixels, file size: 125 KB, MIME type: image/jpeg)"
- File:Rainbow trout.png shows "Rainbow_trout.png (300 × 300 pixels, file size: 158 KB, MIME type: image/png)"
- Specify the full width and height for each image, of the form:
Multiple rows
To create an array of images, with multiple rows, use Template:Para. The value passed to Template:Para may be a single number, or a list of numbers delimited by /. This feature may also be combined with Template:Para for multiple rows of images with the same total width.
Template loop detected: Template:Multiple image
{{multiple image|perrow = 2|total_width=300
| image1 = Kern_Theodolit_DKM2-A.jpg
| image2 = Total-Robotic-Station.jpg
| image3 = DumpyLevel.jpg
| image4 = GPS_Survey_Equipment_at_Weir_Dyke_Bridge_-_geograph.org.uk_-_336908.jpg
| footer = Surveying Equipment. Clockwise from upper left: Optical Theodolite, Robotic total station, Optical level, [[Real-time kinematic | RTK]] GPS Base station.
}}
Template:Clear right
Removing the image border
The border around the images can be removed using Template:Para. Template loop detected: Template:Multiple image
{{multiple image
| align = right
| total_width = 320
| image_style = border:none;
| image1 = Donkey 1 arp 750px.jpg
| alt1 = A donkey
| caption1 = Image of a donkey
| image2 = Rainbow_trout.png
| alt2 = A trout
| caption2 = Image of a trout
}}Template:Clear right
Increasing the gap between images
The gap between the images can be increased using Template:Para, where N is the number of pixels (must be non-negative). Template loop detected: Template:Multiple image
{{multiple image
| align = right
| total_width = 320
| image_gap = 20
| image1 = Donkey 1 arp 750px.jpg
| alt1 = A donkey
| caption1 = Image of a donkey
| image2 = Rainbow_trout.png
| alt2 = A trout
| caption2 = Image of a trout
}}Template:Clear right
TemplateData
Tracking categories
See also
- {{Gallery}}
- {{Image array}}
- {{Image frame}}
- {{Photomontage}}
{{#ifeq:Multiple image|sandbox | | }} Is it possible to put this template in an infobox or frame without changing the size of the captions? Jarble (talk) 16:05, 23 September 2023 (UTC)
Testing wrapping
I pulled this from another page to test whether it wraps. I couldn't tell there because it was under a wide table. Apparently, it does not wrap here. Why doesn't it wrap as the screen narrows? A better option may be Help:Table#Side by side tables and the following section. I have used it often. It wraps.
{{#ifeq: multiple image | doc
|
{{
#ifeq: show | show| {{#ifeq:|yes||
| {{{topimage}}}{{#if: | {{{topcaption}}} }} |
| {{{pretitle}}} |
| }}Message box meta-templates |
|---|
| {{{image}}}{{#if: | {{{caption}}} }} |
| {{{above}}} |
| {{{heading1}}} |
|
| {{{heading2}}} |
| {{{content2}}} |
| {{{heading3}}} |
| {{{content3}}} |
| {{{heading4}}} |
| {{{heading5}}} |
| {{{content5}}} |
| {{{heading6}}} |
| {{{content6}}} |
| {{{heading7}}} |
| {{{content7}}} |
| {{{heading8}}} |
| {{{content8}}} |
| {{{heading9}}} |
| {{{content9}}} |
| {{{heading10}}} |
| {{{content10}}} |
| {{{heading11}}} |
| {{{content11}}} |
| {{{heading12}}} |
| {{{content12}}} |
| {{{heading13}}} |
| {{{content13}}} |
| {{{heading14}}} |
| {{{content14}}} |
| {{{heading15}}} |
| {{{content15}}} |
| {{{heading16}}} |
| {{{content16}}} |
| {{{heading17}}} |
| {{{content17}}} |
| {{{heading18}}} |
| {{{content18}}} |
| {{{heading19}}} |
| {{{content19}}} |
| {{{heading20}}} |
| {{{content20}}} |
| {{{heading21}}} |
| {{{content21}}} |
| {{{heading22}}} |
| {{{content22}}} |
| {{{heading23}}} |
| {{{content23}}} |
| {{{heading24}}} |
| {{{content24}}} |
| {{{heading25}}} |
| {{{content25}}} |
| {{{heading26}}} |
| {{{content26}}} |
| {{{heading27}}} |
| {{{content27}}} |
| {{{heading28}}} |
| {{{content28}}} |
| {{{heading29}}} |
| {{{content29}}} |
| {{{heading30}}} |
| {{{content30}}} |
| {{{heading31}}} |
| {{{content31}}} |
| {{{heading32}}} |
| {{{content32}}} |
| {{{heading33}}} |
| {{{content33}}} |
| {{{heading34}}} |
| {{{content34}}} |
| {{{heading35}}} |
| {{{content35}}} |
| {{{below}}} |
| {{#switch: mbox templates
|table={ class="wikitable" !Comenius OSM and Tourism !Sl: Life Long Learning Mapping Project !Ro: Life Long Learning Mapping Project !Pt:Life Long Learning Mapping Project !Tr: Life Long Learning Mapping Project !DE: Life Long Learning Mapping Project } |line=Comenius - To boost local and international tourism with OpenStreetMap - BoostOSM
{ class="center" - style="width:16%;vertical-align:bottom;" File:Merge.png } |small=Template:Navigation bar | #default =Template:Navigation bar }}
|
}}{{
#if:
|
| {{#ifexist:Template:Multiple image|[[Category:{{
#switch: Template
| Template = Template
| User = User
| #default = Wikipedia
}} documentation pages]]|}}
}}
| }} Template:Lua
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: Template:Tq)
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
- <source lang="xml">
Template loop detected: Template:Multiple image </source>
- Automatic resizing of all images to the same height and to a given total width
- <source lang="xml">
Template loop detected: Template:Multiple image </source>
| 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 Template:Mono 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 Template:Mono and Template:Mono. |
| 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 Template:Mono (if set). (2) The full width of the original [n]th image if Template:Mono 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 Template:Mono 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. Template:Mono), 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
Template loop detected: Template:Multiple image
{{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.
}}
Template loop detected: Template:Multiple image
{{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.
}}
Template loop detected: Template:Multiple image
{{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.
}}
Template:Clear right
With background color
Template loop detected: Template:Multiple image
<source lang="moin" style="overflow:auto;"> Template loop detected: Template:Multiple image </source>
With links (link[n])
Template loop detected: Template:Multiple image Template:Clear left <source lang="moin" style="overflow:auto;"> Template loop detected: Template:Multiple image </source>Template:Clear right
Using direction
By default, the images the template presents are displayed horizontally, as a row (see left; equivalent to setting Template:Mono). To display them vertically, i.e. as a column, set Template:Mono (see right). Template loop detected: Template:Multiple image Template loop detected: Template:Multiple image
On mobile devices some images may always be displayed vertically if the total width is larger than around 320.
To match image heights
- Decide on a total width for all the images, say 320px
- Set the total width using Template:Para
Template loop detected: Template:Multiple image
{{multiple image
| align = right
| total_width = 320
| image1 = Donkey 1 arp 750px.jpg
| alt1 = A donkey
| caption1 = Rectangular image of a donkey, originally 536 pixels high.
| image2 = Rainbow_trout.png
| alt2 = A trout
| caption2 = Square image of a trout, originally 300 pixels high.
| footer = Both images have been rendered with the same height, and a total width of 320px
}}
The aspect ratio of each image is automatically retrieved from the File metadata. You can override the native width and height values by
- Examining the individual image pages to obtain the full resolution. For example:
- File:Donkey 1 arp 750px.jpg shows "Donkey_1_arp_750px.jpg (750 × 536 pixels, file size: 125 KB, MIME type: image/jpeg)"
- File:Rainbow trout.png shows "Rainbow_trout.png (300 × 300 pixels, file size: 158 KB, MIME type: image/png)"
- Specify the full width and height for each image, of the form:
Multiple rows
To create an array of images, with multiple rows, use Template:Para. The value passed to Template:Para may be a single number, or a list of numbers delimited by /. This feature may also be combined with Template:Para for multiple rows of images with the same total width.
Template loop detected: Template:Multiple image
{{multiple image|perrow = 2|total_width=300
| image1 = Kern_Theodolit_DKM2-A.jpg
| image2 = Total-Robotic-Station.jpg
| image3 = DumpyLevel.jpg
| image4 = GPS_Survey_Equipment_at_Weir_Dyke_Bridge_-_geograph.org.uk_-_336908.jpg
| footer = Surveying Equipment. Clockwise from upper left: Optical Theodolite, Robotic total station, Optical level, [[Real-time kinematic | RTK]] GPS Base station.
}}
Template:Clear right
Removing the image border
The border around the images can be removed using Template:Para. Template loop detected: Template:Multiple image
{{multiple image
| align = right
| total_width = 320
| image_style = border:none;
| image1 = Donkey 1 arp 750px.jpg
| alt1 = A donkey
| caption1 = Image of a donkey
| image2 = Rainbow_trout.png
| alt2 = A trout
| caption2 = Image of a trout
}}Template:Clear right
Increasing the gap between images
The gap between the images can be increased using Template:Para, where N is the number of pixels (must be non-negative). Template loop detected: Template:Multiple image
{{multiple image
| align = right
| total_width = 320
| image_gap = 20
| image1 = Donkey 1 arp 750px.jpg
| alt1 = A donkey
| caption1 = Image of a donkey
| image2 = Rainbow_trout.png
| alt2 = A trout
| caption2 = Image of a trout
}}Template:Clear right
TemplateData
Tracking categories
See also
- {{Gallery}}
- {{Image array}}
- {{Image frame}}
- {{Photomontage}}
{{#ifeq:Multiple image|sandbox | | }} --Timeshifter (talk) 06:18, 23 September 2023 (UTC)
- because it is designed to always put the images next to eachother. Its not a gallery, it's a composite. —TheDJ (talk • contribs) 12:24, 23 September 2023 (UTC)
alt & link
Parameters alt & link don't seem to runs well:
- In first doc example (red & gold cards), with
altand withoutlink: alt doesn't show, but link to commons image description - In mule & donkey example, the mule has
altandlink: both of them runs well, it is, image links to mule and alt shows "mule" too. The donkey hasaltandlink without value: alt wrongly doesn't show and image correctly not link.
In summary: alt parameter only act when link is present and not empty.
Does somebody fix it?. Thanks Amadalvarez (talk) 15:31, 10 October 2023 (UTC)
