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:Wiki.png|Item 1 File:Wiki.png|a link to [[Help:Contents]] File:Wiki.png File:Wiki.png|alt=An example image. It has flowers File:Wiki.png|''italic caption'' Wiki.png|on page "{{PAGENAME}}" </gallery>
is formatted as:
-
Item 1
-
a link to Help:Contents
-
-
-
italic caption
-
on page "Gallery"
Mode parameter[edit source]
A mode parameter is available, taking options as follows:
traditional
is the original gallery type used by MediaWiki.nolines
is similar totraditional
, but with no border lines.packed
causes 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-overlay
shows the caption overlaid on the image, in a semi-transparent white box.packed-hover
is similar topacked-overlay
, but with the caption and box only showing up on hover.slideshow
creates a slideshow of the images.
Optional gallery attributes[edit source]
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[edit source]
- Help:Images The MediaWiki help page on images