Help:Gallery
Galleries are an image syntax that creates a gallery of thumbnails (or similar image series). The syntax is:
<gallery>
File:file_name.ext|caption|alt=alt language
File:file_name.ext|caption|alt=alt language
{...}
</gallery>
Note that the image code is not enclosed in brackets when enclosed in gallery tags. Images can be preceded by Image:, File: or nothing, however using Image: is preferred.
Captions are optional, and may contain wiki links or other formatting. Some of the parameters controlling thumb output can also be used here, specifically the ones that modify the file (as opposed to ones that control where in the page the image falls). For example, with multi-paged media like pdfs, you can use code like page=4.
The File: prefix can be omitted. However, it is helpful to include it as an aid for quickly locating image specifiers in the wikitext (for example, when cleaning up page layout).
Note that currently we do not support pdfs!
For example:
<gallery>
File:Earth Icon.png|Item 1
File:Earth Icon.png|a link to [[Help:Contents]]
File:Earth Icon.png
File:Earth Icon.png|alt=An example image. It has flowers
File:Earth Icon.png|''italic caption''
Earth Icon.png|on page "{{PAGENAME}}"
File:Using Firefox.pdf|page=72
</gallery>
is formatted as:
-
Item 1
-
a link to Help:Contents
-
italic caption
-
on page "Gallery"
-
page=72
Mode parameter
A mode parameter is available, taking options as follows:
traditionalis the original gallery type used by MediaWiki.nolinesis similar totraditional, but with no border lines.packedcauses images to have the same height but different widths, with little space between the images. The rows in this responsive mode organize themselves according to the width of the screen.packed-overlayshows the caption overlaid on the image, in a semi-transparent white box.packed-hoveris similar topacked-overlay, but with the caption and box only showing up on hover.slideshowcreates a slideshow of the images.
Optional gallery attributes
The gallery tag itself takes several additional parameters, specified as attribute name-value pairs:
<gallery {parameters}>
{images}
</gallery>
caption="{caption}": (caption text between double quotes for more than a word) sets a caption centered atop the gallery. Only plain text may be used in the caption; formatting, templates and the like will not work.widths={width}px: sets the (max) widths of the images; the default value is 120px. Note the plural: widths.heights={heights}px: sets the (max) heights of the images; the default value is 120px.perrow={integer}: sets the number of images per row. 0 means automatically adjust based on width of screen.showfilename={anything}: Show the filenames of the images in the individual captions for each image (1.17+).mode={traditional|nolines|packed|packed-hover|packed-overlay|slideshow}: See section above (1.22+; 1.28+ for "slideshow").showthumbnails: For "slideshow" mode only, display the strip with image thumbnails below the slideshow by default (1.29+).
See also
- Help:Images The MediaWiki help page on images