Template:Annotated image 4

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Documentation icon Template documentation[view] [edit] [history] [purge]
This is a barnstar from WP:MED that uses this template.

This template was made for annotating generic images (like the thumbnail to the right) and page-spanning diagrams (see #Examples) with a more normal appearance and more alignment options than Template:Annotated image.

Parameters[edit]

Standard set

{{Annotated image 4
| caption =
| header =
| alt =
| image =
| align =
| image-width =
| width =
| height =
| annot-font-size =
| annotations =
{{Annotation|<!--X-->|<!--Y-->|<!--Wikilink-->}}
{{Annotation|<!--X-->|<!--Y-->|<!--Wikilink-->}}
{{Annotation|<!--X-->|<!--Y-->|<!--Wikilink-->}}
}}

Extended set

{{Annotated image 4
| caption =
| header =
| header_align =
| header_background =
| alt =
| image =
| align =
| image-width =
| image-left =
| image-top =
| width =
| height =
| annot-font-size =
| annot-text-align =
| annotations =
{{Annotation|<!--X-->|<!--Y-->|<!--Wikilink-->}}
{{Annotation|<!--X-->|<!--Y-->|<!--Wikilink-->}}
{{Annotation|<!--X-->|<!--Y-->|<!--Wikilink-->}}
}}

Definitions[edit]

Bolded parameters are new, while italicized parameters are defined differently from Template:Annotated image
Name Allowed values Default value Function & notes
image valid image file name (required) Raster graphics (jpg, png, etc) and SVG images are allowed.
There must be a file page for the image on Wikimedia Commons, or the image will lead to a file page that doesn't exist when it is clicked. In other words, local images (those located only on en.wiki or other language wikis) without a commons page shouldn't be used in this template.
image-width positive integer (required) Desired width of the image (in pixels).
width positive integer (required) Same as template:Annotated image definition. For simplicity, set this equal to image-width.
height positive integer (required) Ensure that (Width x Height) maintains the same aspect-ratio as the default size of the image you want to use for proper display.
E.g., a 500x600 default image should be scaled to 250x300 or similar for proper appearance.
annotations {{Annotation}} (required) May be left empty if you only want to crop an image – for that, use
"|annotation=|" (without quotes)
image-left integer (optional; defaults to 0) X-coordinate of the image's top left corner (in pixels), relative to the top left corner of the box containing the image and annotations. Negative values crop the image.
Unnecessary when cropping isn't desired
image-top integer (optional; defaults to 0) Y-coordinate of the image's top left corner (in pixels), relative to the top left corner of the box containing the image and annotations. Negative values crop the image.
Unnecessary when cropping isn't desired
image-bg-color valid web colors
(e.g., html color names & hex codes)
(optional, white) Background of the box in which the image is displayed.
caption wikitext (optional) Caption of the image with the typical appearance (different appearance from Template:Annotated image)
alt plain text (optional) Alt text of image, for readers who cannot see it; see WP:ALT for the MOS entry
header wikitext (optional) Adds an image header like those in the examples on this page
header_align right, left, or center (optional, center) Sets the header alignment to left, center, or right.
header_background valid web colors
(e.g., html color names & hex codes)
(optional, transparent) Sets the header background color
align right, left, or center (optional, right) Sets the template to align to the left or right, or at the center of the page.
annot-text-align right, left, or center (optional, center) Sets a default text-alignment for all annotations.
annot-background-color valid web colors
(e.g., html color names & hex codes)
(optional, transparent) Sets a default background-color for all annotations.
annot-font-size positive integer (optional) Sets a default font-size (in pixels) for all annotations.
annot-color valid web colors
(e.g., html color names & hex codes)
(optional, black) Sets a default color for all annotations.

Examples[edit]

Image-insertion templates that use Template:Annotated image 4[edit]

Example 1 (left-aligned)[edit]

The result of
and this annotation template
See also:{{P|22}}

Example 2 (centered)[edit]

Metabolic pathways of amphetamine
Graphic of several routes of amphetamine metabolism
Para-
Hydroxylation
Para-
Hydroxylation
Para-
Hydroxylation
Beta-
Hydroxylation
Beta-
Hydroxylation
Oxidative
Deamination
Oxidation
Glycine
Conjugation
Default caption

Template:Annotation parameters[edit]

Template:Annotation requires three unnamed parameters in order to function correctly. For explanatory purposes, the parameter definitions that follow will refer to these unnamed parameters as displayed in the example template below.

Required parameters
{{Annotation|<!--PX FROM LEFT-->|<!--PX FROM TOP-->| <!--Wikitext--> }}
Full parameter set
{{Annotation|<!--PX FROM LEFT-->|<!--PX FROM TOP-->| <!--Wikitext--> 
 | text-align= | font-size= | background-color= | color= }}
Required parameter definitions
  1. <!--PX FROM LEFT--> (first unnamed parameter) - this field should be a replaced with a numerical value without spaces between the vertical bars.
    This field specifies the horizontal distance (measured in pixels) from the left side of the image that the annotation text will be placed. Higher values will move an annotation further to the right.

  2. <!--PX FROM TOP--> (second unnamed parameter) - this field should be a replaced with a numerical value without spaces between the vertical bars.
    This field specifies the vertical distance (measured in pixels) from the top of the image that the annotation text will be placed. Higher values will move an annotation downward.

  3. <!--Wikitext--> (third unnamed parameter) - add your wikitext (e.g., plain text, wikilinks, references, other templates, etc) in this field.

Pictogram voting info.svg Note: For the first two unnamed parameters (i.e., |<!--PX FROM LEFT-->|<!--PX FROM TOP-->| from the example above), including spaces between the vertical bars will result in a parsing error which will make you sad. As an example, to specify 200 by 300 pixels here, you should only use |200|300| instead of | 200 | 300| or similar.

Template:Annotation examples[edit]

A 200 by 300 pixel image
Example
wikitext
2
Example
wikitext 3

The following annotation templates are examples that will parse correctly for a 200x300px image. Using Template:Annotated image 4 and a white 200x300px image, they will render as displayed in the thumbnail to the right of this text.

{{Annotation|55|10| [[Example wikitext 1]] | text-align=right | font-size=16 | background-color=#32CD32 | color=black}}
{{Annotation|20|100| Example<br />[[wikitext]]<br />2 | text-align=left | font-size=20 | background-color=#ffcccee | color=orange}}
{{Annotation|100|200| Example<br />wikitext 3 | text-align=center | font-size=14 | background-color=black | color=white}}
{{Annotation|30|250|[[WP:Annotated image]]}}