Template:Auto images

From Lojban
Revision as of 09:53, 14 March 2014 by Gleki (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Documentation icon Template documentation[view] [edit] [history] [purge]

This template is a simplified version of {{Multiple images}}. It can be used to arrange two to six images in a horizontal row. They will automatically be scaled so that they are all of the same height and together have specified total width. Each image can have its own caption; the complete row can have a title.

Any number of horizontal rows of images can be placed underneath one another to form a combined set.

Usage

Blank template

{{Auto images
|title       = 
|align       = 
|cont        = 
|footer      = 
|total_width = 
|image1      = 
|width1      = 
|height1     = 
|caption1    = 
|alt1        = 
|image2      = 
|width2      = 
|height2     = 
|caption2    = 
|alt2        = 
|image3      = 
|width3      = 
|height3     = 
|caption3    = 
|alt3        = 
|image4      = 
|width4      = 
|height4     = 
|caption4    = 
|alt4        = 
|image5      = 
|width5      = 
|height5     = 
|caption5    = 
|alt5        = 
|image6      = 
|width6      = 
|height6     = 
|caption6    = 
|alt6        = 
}}

Parameters with numerical values, if unused, must be removed and not left blank; if left blank, they may cause undesirable side-effects. These include |widthn=, |heightn= and |total_width=. If |total_width= is omitted, the default value is 600.

Example

{{Auto images
|title=Cactus areoles
|width1=1328|height1= 990|image1=Pereskia grandifolia areole.jpg|caption1=''Pereskia grandiflora''|alt1=Shows leaves emerging from areoles
|width2=4408|height2=3229|image2=Cut Cereus (brightened).jpg|caption2=''Cereus'' cross-section showing the arrangement of areoles
|width3=2736|height3=3648|image3=Echinopsis candicans (3).jpg|caption3=''Echinopsis candicans''
|width4= 528|height4= 552|image4=Astrophytum capricorne areole.jpg
|caption4=Close up of an areole of ''Astrophytum capricorne''|alt4=Shows fine wool covering areoles
|footer=Areoles are characteristic of all cacti, whether or not they have leaves.
}}

produces


Cactus areoles
Shows leaves emerging from areoles
Pereskia grandiflora

Cereus cross-section showing the arrangement of areoles

Echinopsis candicans
Shows fine wool covering areoles
Close up of an areole of Astrophytum capricorne


Areoles are characteristic of all cacti, whether or not they have leaves.

Parameters

Four parameters apply to the set of images as whole.

  • title – specifies an optional title placed at the top of the set of images.
  • total_width – optionally specifies the total width of the set of images. The default is 600 (pixels), which is good for a screen width of 800 and for printing.
  • footer – optionally specifies footer text which runs across the bottom of all of the images.
  • align – a value of left aligns the set of images to the left of the page; a value of right aligns them to the right of the page. The default is to centre the images on the page. Note: text does not flow around the sides of the images, regardless of the alignment. For this effect, see below.
  • cont – any nonblank value (e.g. yes) is used to combine a row of images produced by this template with the one above – see below.

Each image is described by five parameters. "N" below takes the values 1, 2, ..., 6 for the maximum of six images.

  • widthN – this is the width in pixels of the full resolution version of the image in Commons or Wikipedia. Examine the individual image page to obtain the full resolution.
  • heightN – this is the height in pixels of the full resolution version of the image in Commons or Wikipedia.
  • imageN – the name of the image in Commons or Wikipedia (do not precede by "File:" or "Image:").
  • captionN – an optional caption for the image.
  • altN – alternative text. See WP:ALT.

Examples

The great advantage of this template over {{Multiple image}} is that if you decide to add or remove an image or change the total width of the row of images, you don't have to recalculate the widths. Thus:

{{Auto images
|align=left
|total_width=300
|width1=1328|height1= 990|image1=Pereskia grandifolia areole.jpg|caption1=''Pereskia grandiflora''
|width2=4408|height2=3229|image2=Cut Cereus (brightened).jpg|caption2=''Cereus'' cross-section showing the arrangement of areoles
|width3=2736|height3=3648|image3=Echinopsis candicans (3).jpg|caption3=''Echinopsis candicans''
}}

produces


Pereskia grandiflora

Cereus cross-section showing the arrangement of areoles

Echinopsis candicans



{{Auto images
|title=Cactus areoles
|align=right
|total_width=200
|width1=2736|height1=3648|image1=Echinopsis candicans (3).jpg
|width2= 528|height2= 552|image2=Astrophytum capricorne areole.jpg
}}

produces

Cactus areoles




Combining rows of images

To produce multiple horizontal rows of images, the template can be repeated any number of times, using the same value of total_width each time. Specifying cont = yes (or any other nonblank value) on the second and subsequent uses ensures that there is only a single line between the two rows; without it there will be a double line.

{{Auto images
|title=Stages in the life of the [[American Robin]]
|width1= 500|height1= 749|image1=American Robin Nest.jpg
|width2=3888|height2=2592|image2=Robin's Nest - Charlotte NC.jpg
|width3=1024|height3= 768|image3=AmericanRobinChicksInNest 1.jpg
}}
{{Auto images
|cont=yes
|width1= 600|height1= 479|image1=Robin chick 2 Galawebdesign.jpg
|width2=5184|height2=3456|image2=Turdus migratorius -Smithsonian National Zoological Park, Washington, USA -juvenile-8.jpg
|width3=1350|height3=1024|image3=Turdus-migratorius-002.jpg
}}

produces

Stages in the life of the American Robin










Embedding images in text

This template does not allow text to flow around it, i.e. it does not allow images to be embedded in text. For maximum flexibility, use the more advanced template {{Multiple image}}.

Images displayed by this template can be embedded in text to the left or right by enclosing uses of the template in an appropriate HTML div.

  • To display embedded images to the left, enclose the template(s) in <div style="float:left;margin-right:1em;"> ... </div>.
  • To display embedded images to the right, enclose the template(s) in <div style="float:right;margin-left:1em;"> ... </div>.

Thus the following produces the images to the right:

<div style="float:right;margin-left:1em;">
{{Auto images
|total_width=200|title=[[American Robin]]s
|width1=3888|height1=2592|image1=Robin's Nest - Charlotte NC.jpg
|width2=1024|height2= 768|image2=AmericanRobinChicksInNest 1.jpg
}}
{{Auto images
|total_width=200|cont=yes
|width1= 600|height1= 479|image1=Robin chick 2 Galawebdesign.jpg
|width2=5184|height2=3456|image2=Turdus migratorius -Smithsonian National Zoological Park, Washington, USA -juvenile-8.jpg
|width3=1350|height3=1024|image3=Turdus-migratorius-002.jpg
}}
</div>

Limitations, debugging

  • Only a maximum of six images are allowed in a row. Unless the total width is made large, which is undesirable for printing and for readers with smaller screens, more than this number of images means that they are likely to be rather small.
  • Regardless of the alignment of the images, text does not flow around them. For this feature, see above.
  • If the displayed images are not all of the same height, then the widthN and heightN parameters have been omitted or set incorrectly for one or more images. Recall that they should be the width and height of the highest resolution version of the image in Commons or Wikipedia.
  • A long title can force a row of images to be wider than the specified value of total_width.

See also

  • {{Multiple image}} – this is much more flexible in its layout, but requires manual calculation to ensure that all the images are of the same height.

ko:틀:자동그림