Template:Gallery

From Biodiversity of India
Jump to: navigation, search


Flag of None.svg
 
[edit] [purge] Template documentation

This {{Gallery}}, using {{Gallery/aux}}, shows up to 100 images with caption. Each image with caption is embedded in a HTML-table of the same size. As a result the browser displays them row by row, with as many on one row as fit in the window.

MediaWiki already has such a feature included: It's named <gallery>, but it has a limitation (that's my euphemism for bug): There must not be used templates or other dynamic content inside the gallery tags. The following example will display absolutely nothing (it will render as if there weren't any gallery at all):


 <gallery>

 {{linegenerator|ImageA}}

 {{linegenerator|ImageB}}

 {{linegenerator|ImageC}}

 </gallery>

Where {{linegenerator}} shall be an example for a template which generates something like


     Image:ImageX.abc|Some Text...

The intended result is of course something like


 <gallery>

     ImageA.abc|Something about image A

     ImageB.abc|and Image B

     ImageC.abc|and so on...

 </gallery>

But this won't happen. The {{Gallery}} is a workaround for this bug. There's also another solution which uses mediawiki internal syntax:


{{#tag: gallery|

     ImageA.abc{{!}}Something about image A

     ImageB.abc{{!}}Something about B...

}}

In this construction even templates can be used:


{{#tag: gallery|

   {{linegenerator|ImageA}}

   {{linegenerator|ImageB}}

   {{linegenerator|ImageC}}

}}

Notice, however, the usage of {{!}}. {{linegenerator}} therefore must produce something like


     Image:ImageX.abc{{!}}Some Text...

The usage of {{Gallery}} is almost like with those gallery tags, aside from these two parameters:

The parameters are width and lines.

The lines parameter specifies the number of lines for the caption. If for an image the text does not fit in this number of lines a vertical scroll bar appears for the caption this image. Typically this lines parameter is set depending on the width parameter and the maximum length of all captions, and such that even for users with a large font setting it is enough, since the vertical scroll bar is not convenient, but just an "emergency measure".

If a word in a caption is longer than the width of the image a horizontal scroll bar appears. The appearance of a horizontal and vertical scrollbar are independent of each other.

Example

Foto's
Oostzijde Centraal Station
Oostzijde Centraal Station  
Stationsplein Amsterdam
Stationsplein Amsterdam  
Het station vanaf de Oude Kerkstoren
Het station vanaf de Oude Kerkstoren  
Het station vanuit het oosten
Het station vanuit het oosten  
Oostzijde Centraal Station
Oostzijde Centraal Station  
Stationsplein Amsterdam
Stationsplein Amsterdam  
Het station vanaf de Oude Kerkstoren
Het station vanaf de Oude Kerkstoren  
Het station vanuit het oosten
Het station vanuit het oosten  
Oostzijde Centraal Station
Oostzijde Centraal Station  
Stationsplein Amsterdam
Stationsplein Amsterdam  
Het station vanaf de Oude Kerkstoren
Het station vanaf de Oude Kerkstoren  
Het station vanuit het oosten
Het station vanuit het oosten  
Oostzijde Centraal Station
Oostzijde Centraal Station  
Stationsplein Amsterdam
Stationsplein Amsterdam  
Het station vanaf de Oude Kerkstoren
Het station vanaf de Oude Kerkstoren  
Het station vanuit het oosten
Het station vanuit het oosten  
Oostzijde Centraal Station
Oostzijde Centraal Station  
Stationsplein Amsterdam
Stationsplein Amsterdam  
Het station vanaf de Oude Kerkstoren
Het station vanaf de Oude Kerkstoren  
Het station vanuit het oosten
Het station vanuit het oosten  

Sourcecode of example


{{Gallery

|caption=Foto's

|width=150

|lines=3

|Image:Oost_amsterdam_cs.JPG|Oostzijde Centraal Station

|Image:AMS_central_station_3.jpg|[[Stationsplein (Amsterdam)|Stationsplein]] Amsterdam

|Image:Asd_cs_afstand.JPG|Het station vanaf de [[Oude Kerkstoren]]

<!-- ... -->

}}

The source and idea for this template come from meta:Template:Gallery.