Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Numinix MediaWiki Demo
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Help/Images
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Rendering a gallery of images == <!--T:123--> === Gallery syntax === <!--T:124--> </translate> <translate><!--T:125--> It's easy to make a gallery of thumbnails with the <tvar name=gallery></tvar> tag.</translate> <translate><!--T:126--> The syntax is:</translate> <syntaxhighlight lang=wikitext> <gallery> File:file_name.ext|caption|alt=alt language File:file_name.ext|caption|alt=alt language {...} </gallery> </syntaxhighlight> <translate> <!--T:127--> Note that the image code is not enclosed in brackets when enclosed in gallery tags. </translate> <translate><!--T:128--> Captions are optional, and may contain wiki links or other formatting.</translate> </tvar> for details.</translate>}} <translate><!--T:129--> 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).</translate> <translate><!--T:130--> For example, with multi-paged media like pdfs, you can use code like <tvar name=1><code>page=4</code></tvar> and with videos you can use <tvar name=2><code>thumbtime=10</code></tvar>.</translate> <translate><!--T:131--> The <tvar name=file><code>File:</code></tvar> prefix can be omitted.</translate> <translate><!--T:216--> 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).</translate> <translate> <!--T:290--> If the image links to an external site, the caption must come ''before'' the link parameter or the caption will not render. <!--T:132--> For example: </translate> <syntaxhighlight lang="wikitext"> <gallery> File:Example.jpg|<translate nowrap><!--T:293--> Item 1</translate> File:Example.jpg|<translate nowrap><!--T:294--> a link to <tvar name=1>[[Help:Contents]]</tvar></translate> File:Example.jpg File:Example.jpg|alt=<translate nowrap><!--T:295--> An example image. It has flowers</translate> File:Example.jpg|''<translate nowrap><!--T:296--> italic caption</translate>'' File:Example.jpg|link=https://example.com|<translate nowrap><!--T:297--> This text will not render because an external link came first</translate> File:Example.jpg|<translate nowrap><!--T:298--> Links to external website</translate>|link=https://example.com File:Example.jpg|link=w:Main_Page|<translate nowrap><!--T:299--> Internal link</translate> Example.jpg|on page "" File:Using Firefox.pdf|page=72 </gallery> </syntaxhighlight> <translate> <!--T:133--> is formatted as: </translate> <gallery> File:Example.jpg|<translate><!--T:300--> Item 1</translate> File:Example.jpg|<translate><!--T:301--> a link to <tvar name=1>[[Help:Contents]]</tvar></translate> File:Example.jpg File:Example.jpg|alt=<translate><!--T:302--> An example image. It has flowers</translate> File:Example.jpg|''<translate><!--T:303--> italic caption</translate>'' File:Example.jpg|link=https://example.com|<translate><!--T:304--> This text will not render because an external link came first</translate> File:Example.jpg|<translate><!--T:305--> Links to external website</translate>|link=https://example.com File:Example.jpg|link=w:Main_Page|<translate><!--T:306--> Internal link</translate> Example.jpg|on page "" File:Using Firefox.pdf|page=72 </gallery> <translate> === <tvar name=1>mode</tvar> parameter === <!--T:134--> </translate> <translate> <!--T:135--> Starting in MediaWiki version 1.22 a <tvar name=1><code>mode</code></tvar> parameter is available, taking options as follows: <!--T:136--> * <tvar name=1><code>traditional</code></tvar> is the original gallery type used by MediaWiki.</translate> <translate> <!--T:137--> * <tvar name=1><code>nolines</code></tvar> is similar to <tvar name=2><code>traditional</code></tvar>, but with no border lines.</translate> <translate> <!--T:138--> * <tvar name=1><code>packed</code></tvar> causes images to have the same height but different widths, with little space between the images.</translate> <translate><!--T:139--> The rows in this [[w:Responsive web design|responsive]] mode organize themselves according to the width of the screen regardless of default gallery settings.</translate> <translate> <!--T:140--> * <tvar name=1><code>packed-overlay</code></tvar> shows the caption overlaid on the image, in a semi-transparent white box.</translate> <translate> <!--T:141--> * <tvar name=1><code>packed-hover</code></tvar> is similar to <tvar name=2><code>packed-overlay</code></tvar>, but with the caption and box only showing up on hover.</translate> * <translate><!--T:206--> <tvar name=1><code>slideshow</code></tvar> creates a slideshow of the images.</translate> <translate> <!--T:142--> For example: </translate> <syntaxhighlight lang="wikitext"> <gallery mode="packed-hover"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) File:Pterois volitans Manado-e.jpg|''[[commons:Pterois volitans|Pterois volitans]]'' (Red Lionfish) File:Macropodus opercularis - front (aka).jpg|''[[commons:Macropodus opercularis|Macropodus opercularis]]'' (Paradise fish) File:Canthigaster valentini 1.jpg|''[[commons:Canthigaster valentini|Canthigaster valentini]]'' (Valentinni's sharpnose puffer) File:Flughahn.jpg|[[File:POTY ribbon 2007.svg|25px]] ''[[commons:Dactylopterus volitans|Dactylopterus volitans]]'' (Flying gurnard) File:Fishmarket 01.jpg|''[[commons:Semicossyphus pulcher|Semicossyphus pulcher]]'' (California Sheephead) File:Pseudorasbora parva(edited version).jpg|''[[commons:Category:Pseudorasbora parva|Pseudorasbora parva]]'' (Topmouth gudgeon) File:MC Rotfeuerfisch.jpg|''[[commons:Category:Pterois antennata|Pterois antennata]]'' (Antennata Lionfish) File:Cleaning station konan.jpg|''[[commons:Novaculichthys taeniourus|Novaculichthys taeniourus]]'' File:Synchiropus splendidus 2 Luc Viatour.jpg|''[[commons:Synchiropus splendidus|Synchiropus splendidus]]'' (Mandarin fish) File:Psetta maxima Luc Viatour.jpg|''[[commons:Psetta maxima|Psetta maxima]]'' (Turbot) File:Australian blenny.jpg|''[[commons:Category:Ecsenius|Ecsenius axelrodi]]'' </gallery> </syntaxhighlight> <translate> <!--T:143--> Gives (mode: <tvar name=hover><code>packed-hover</code></tvar>): </translate> <gallery mode="packed-hover"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) File:Pterois volitans Manado-e.jpg|''[[commons:Pterois volitans|Pterois volitans]]'' (Red Lionfish) File:Macropodus opercularis - front (aka).jpg|''[[commons:Macropodus opercularis|Macropodus opercularis]]'' (Paradise fish) File:Canthigaster valentini 1.jpg|''[[commons:Canthigaster valentini|Canthigaster valentini]]'' (Valentinni's sharpnose puffer) File:Flughahn.jpg|[[File:POTY ribbon 2007.svg|25px]] ''[[commons:Dactylopterus volitans|Dactylopterus volitans]]'' (Flying gurnard) File:California Sheephead (Semicossyphus pulcher) at Ensenada's fishmarket.jpg|''[[commons:Semicossyphus pulcher|Semicossyphus pulcher]]'' (California Sheephead) File:Pseudorasbora parva(edited version).jpg|''[[commons:Category:Pseudorasbora parva|Pseudorasbora parva]]'' (Topmouth gudgeon) File:MC Rotfeuerfisch.jpg|''[[commons:Category:Pterois antennata|Pterois antennata]]'' (Antennata Lionfish) File:Cleaning station konan.jpg|''[[commons:Novaculichthys taeniourus|Novaculichthys taeniourus]]'' File:Synchiropus splendidus 2 Luc Viatour.jpg|''[[commons:Synchiropus splendidus|Synchiropus splendidus]]'' (Mandarin fish) File:Psetta maxima Luc Viatour.jpg|''[[commons:Psetta maxima|Psetta maxima]]'' (Turbot) File:Australian blenny.jpg|''[[commons:Category:Ecsenius|Ecsenius axelrodi]]'' </gallery> <translate> <!--T:144--> Examples of the other modes: </translate> <code>mode="traditional"</code> <gallery mode="traditional"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="nolines"</code> <gallery mode="nolines"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="packed"</code> <gallery mode="packed"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="packed-overlay"</code> <gallery mode="packed-overlay"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code>mode="packed-hover"</code> <gallery mode="packed-hover"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) </gallery> <code id="slideshow-demo">mode="slideshow"</code> <gallery mode="slideshow"> File:Astronotus_ocellatus.jpg|''[[commons:Astronotus ocellatus|Astronotus ocellatus]]'' (Oscar) File:Salmonlarvakils.jpg|''[[commons:Salmo salar|Salmo salar]]'' (Salmon Larva) File:Georgia Aquarium - Giant Grouper.jpg|''[[commons:Epinephelus lanceolatus|Epinephelus lanceolatus]]'' (Giant grouper) File:Pterois volitans Manado-e.jpg|''[[commons:Pterois volitans|Pterois volitans]]'' (Red Lionfish) File:Macropodus opercularis - front (aka).jpg|''[[commons:Macropodus opercularis|Macropodus opercularis]]'' (Paradise fish) File:Canthigaster valentini 1.jpg|''[[commons:Canthigaster valentini|Canthigaster valentini]]'' (Valentinni's sharpnose puffer) File:Flughahn.jpg|[[File:POTY ribbon 2007.svg|25px]] ''[[commons:Dactylopterus volitans|Dactylopterus volitans]]'' (Flying gurnard) File:California Sheephead (Semicossyphus pulcher) at Ensenada's fishmarket.jpg|''[[commons:Semicossyphus pulcher|Semicossyphus pulcher]]'' (California Sheephead) File:Pseudorasbora parva(edited version).jpg|''[[commons:Category:Pseudorasbora parva|Pseudorasbora parva]]'' (Topmouth gudgeon) File:MC Rotfeuerfisch.jpg|''[[commons:Category:Pterois antennata|Pterois antennata]]'' (Antennata Lionfish) File:Cleaning station konan.jpg|''[[commons:Novaculichthys taeniourus|Novaculichthys taeniourus]]'' File:Synchiropus splendidus 2 Luc Viatour.jpg|''[[commons:Synchiropus splendidus|Synchiropus splendidus]]'' (Mandarin fish) File:Psetta maxima Luc Viatour.jpg|''[[commons:Psetta maxima|Psetta maxima]]'' (Turbot) File:Australian blenny.jpg|''[[commons:Category:Ecsenius|Ecsenius axelrodi]]'' </gallery> <translate> === Optional gallery attributes === <!--T:145--> <!--T:146--> The gallery tag itself takes several additional parameters, specified as attribute name-value pairs: </translate> <syntaxhighlight lang=html> <gallery {parameters}> {images} </gallery> </syntaxhighlight> <translate> <!--T:147--> * <code>caption="{caption}"</code>: (caption text between double quotes for more than one 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.</translate> <translate> <!--T:148--> * <code>widths={width}</code>: sets the (max) widths of the images in pixels; the [[<tvar name=options>Special:MyLanguage/Manual:$wgGalleryOptions</tvar>|default value]] is 120px.</translate> <translate><!--T:271--> (It has no effect if mode is set to one of the following: <tvar name=1>packed, packed-overlay, packed-hover, slideshow</tvar>.)</translate> ''<translate><!--T:149--> Note the plural: width'''s'''</translate>''. <translate> <!--T:150--> * <code>heights={heights}</code>: sets the (max) heights of the images in pixels; the default value is 120px.</translate> <translate><!--T:272--> (It has no effect if mode is set to <tvar name=1>slideshow</tvar>.)</translate> <translate> <!--T:151--> * <code>perrow={integer}</code>: sets the number of images per row.</translate> <translate><!--T:273--> (It has no effect if mode is set to one of the following: <tvar name=1>packed, packed-overlay, packed-hover, slideshow</tvar>.)</translate> <translate><!--T:152--> The default is <tvar name=1><code>perrow=0</code></tvar> which automatically adjusts the number of images per row based on width of screen.</translate> <translate> <!--T:153--> * <code>showfilename={anything}</code>: Show the filenames of the images in the individual captions for each image (1.17+).</translate> <translate> <!--T:154--> * <code>mode={traditional|nolines|packed|packed-hover|packed-overlay|slideshow}</code>: See section above (1.22+; 1.28+ for "slideshow").</translate> <translate> <!--T:241--> * <code>showthumbnails</code>: For "slideshow" mode only, display the strip with image thumbnails below the slideshow by default (1.29+). </translate> * <translate><!--T:289--> Any html attribute allowed on a <tvar name=1><code><ul></code></tvar> tag (e.g. <tvar name=2><code>id</code></tvar>, <tvar name=3><code>title</code></tvar>, <tvar name=4><code>class</code></tvar>)</translate> {{note|1=<translate><!--T:292--> In packed (and related) modes, the widths parameter has no effect; instead, the heights parameter determines the minimum height of the images.</translate> <translate><!--T:156--> Packed modes adjust the width of images to ensure that each row is of equal length, except when a row contains too few images to achieve this without excessively enlarging the images.</translate>}} <translate> <!--T:260--> ; Example 1 <!--T:261--> Syntax: </translate> <syntaxhighlight lang=html> <gallery widths=300 heights=200> File:Example.jpg|Lorem ipsum File:Example.jpg|Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut </gallery> </syntaxhighlight> <translate> <!--T:262--> Result: </translate> <gallery widths="300" heights="200"> File:Example.jpg|Lorem ipsum File:Example.jpg|Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut </gallery> <translate> <!--T:157--> ; Example 2 <!--T:263--> Syntax: </translate> <syntaxhighlight lang=html> <gallery widths=60 heights=60 perrow=7 caption="<translate nowrap><!--T:288--> sunflowers are groovy</translate>"> File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg </gallery> </syntaxhighlight> <translate> <!--T:159--> Result: </translate> <gallery widths="60" heights="60" perrow="7" caption=""> File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg </gallery> <translate> === Gallery tag === <!--T:311--> </translate> You can also use <code></nowiki>}}</code> magic word (tag) for generating gallery. This is especially useful if you are going to templatize the gallery. Example: <syntaxhighlight lang="wikitext" style="margin-left:25px"> }} }}</syntaxhighlight> or, more advanced: <syntaxhighlight lang="wikitext" style="margin-left:25px"> }} File:}} |widths=} |perrow=} }}</syntaxhighlight> (by [[Help talk:Templates#Gallery In a Template|Hamilton Abreu]]) <translate>
Summary:
Please note that all contributions to Numinix MediaWiki Demo may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)