Template:WpGallery/doc

From WikiEducator
Jump to: navigation, search

N.B. This is a test template adapted from Wikipedia. Ideally it should be moved to Template:Gallery after renaming that one (and adapting all pages which use it to something like "template:Gallery tip".

This template provides advanced gallery building functionality (such as scrolling captions and fine-tuned formatting control). For creating basic galleries, use the Gallery tag.

This template shows up to 110 images in an array, wrapped as left-to-right rows, where all images can be set to the same "width=" or "height=" but also allow width exceptions such as "width3=140" to reset width of only image 3. The number of images per row is based upon the image-width specified and the width of the screen, and can change live as the users narrow their screens and the images re-wrap to view the window as a different size.

For style guidelines about where galleries are appropriate (for Wikipedia), see w:WP:IG.

Parameters

For each image

Specify a line of the following form for each image.

|File:Filename|altN=Alt text|Caption
  • Filename is the image's file name. It can use a File: instead of an Image: prefix.
  • AltN should be "alt1=" for the first image, "alt2=" for the second image, and so forth.
  • Alt text is the alt text for the image, used by visually impaired or other readers who cannot see the image clearly. See Wikipedia:Alternative text for images. If omitted, the image's alt text will be blank.
  • Caption is the caption under the image; see Wikipedia:Captions.

If no such lines are present, a gallery with a single blank image is produced. There is currently a limit of 110 image lines.

Optional parameters

The following parameters apply to all images:

  • title   – The gallery's title.
  • height – (default: 180) Maximum height of each image.
  • width   – (default: 180) Maximum width of each image.
  • cellwidth – (default: width) Width of each image cell or box.
  • lines   – (default: 2) The number of text lines needed for the largest caption. Blank lines are appended to smaller captions. A caption that does not fit is cut off.
  • align   – (default: left) The alignment of the gallery table (left, center, or right).
  • footer – Small, right-aligned text below the images.
  • style   – The CSS style directives for the whole table.
  • boxform – <documentation needed>

The following parameters apply to each image, separately:

  • alt1      – the alt-text for image 1.
  • width1   – (default: width or 180) width of image 1 only.
  • alt2      – the alt-text for image 2.
  • width2   – (default: width or 180) width of image 2 only.
  • alt110    – the alt-text for image 110.
  • width110 – (default: width or 180) the width of image 110 only.

Examples

{{wpGallery
| title=Cultural depictions of George Washington
| width=160 | height=170 | lines=4
| align=center
| File:Federal Hall NYC 27.JPG |
    alt1=Statue facing a city building with Greek columns and huge U.S. flag
  | Statue of Washington outside [[w:Federal Hall|Federal Hall]] in [[w:New York City|New York City]], looking on [[w:Wall Street|Wall Street]].
| File:Mount Rushmore2.jpg |
    alt2=Profile of stone face on mountainside, with 3 workers.
  | Construction of Washington portrait at [[w:Mount Rushmore|Mount Rushmore]], c. 1932.
| File:2006 Quarter Proof.png |
    alt3=Shiny silver coin with profile of Washington bust. 
  | Washington is commemorated on a [[w:Quarter (United States coin)|quarter]].
| File:George Washington Presidential $1 Coin obverse.png |
    alt4=Gold coin with bust of Washington facing slightly left
  | Washington on a [[w:dollar coin (United States)|dollar coin]].
}}
Cultural depictions of George Washington
Statue facing a city building with Greek columns and huge U.S. flag
Statue of Washington outside Federal Hall in New York City, looking on Wall Street.  
Profile of stone face on mountainside, with 3 workers.
Construction of Washington portrait at Mount Rushmore, c. 1932.  
Shiny silver coin with profile of Washington bust.
Washington is commemorated on a quarter.  
Gold coin with bust of Washington facing slightly left
Washington on a dollar coin.  
{{wpGallery
| title=Cultural depictions of George Washington
| cellwidth=210 | width=399 | height=100 | lines=4
| align=center
| File:Federal Hall NYC 27.JPG |
    alt1=Statue facing a city building with Greek columns
  | Statue of Washington outside [[w:Federal Hall|Federal Hall]] in [[w:New York City|New York City]], looking on [[w:Wall Street|Wall Street]].
| File:Mount Rushmore2.jpg |
    alt2=Profile of stone face on mountainside, with 3 workers.
  | Work on Washington portrait at [[w:Mount Rushmore|Mount Rushmore]], c. 1932.
| File:2006 Quarter Proof.png |
    alt3=Shiny silver coin with profile of Washington bust. 
  | Washington on a [[w:Quarter (United States coin)|quarter]].
| File:United_States_one_dollar_bill,_obverse.jpg | width4=170 |
    alt4=Front side of U.S. dollar bill, with Washington portrait in center.
  | [[w:United States one-dollar bill|U.S. one-dollar bill]].
| File:George Washington Presidential $1 Coin obverse.png |
    alt5=Gold coin with bust of Washington facing left
  | Washington on a [[w:dollar coin (United States)|dollar coin]].
}}
Cultural depictions of George Washington
Statue facing a city building with Greek columns
Statue of Washington outside Federal Hall in New York City, looking on Wall Street.  
Profile of stone face on mountainside, with 3 workers.
Work on Washington portrait at Mount Rushmore, c. 1932.  
Shiny silver coin with profile of Washington bust.
Washington on a quarter.  
Front side of U.S. dollar bill, with Washington portrait in center.
Gold coin with bust of Washington facing left
Washington on a dollar coin.  

Note how in the above example, the parameter "width4=170" resets the width of image 4, to allow the dollar-bill to be shorter than the other images of George Washington. However, each specific image width could be set larger, to allow some images to be taller than all the others.

See also