Help:Image syntax

From wipipedia.org
Jump to: navigation, search


Contents

Syntax to use an image in uploaded size, with a caption

To use an image as uploaded with a caption use [[Image:Westminstpalace.jpg|frame|none|caption text]]. This is the syntax you should use to update images which used the original image markup of the form [[Image:Westminsterpalace.jpg|caption]].

caption text

Syntax for images with no automatic caption or formatting

The old syntax for images without captions is [[Image:Westminstpalace.jpg|alt text]]. This is rendered inline, and the specified text is used as the image's alt attribute (alternate text for programs which cannot display images, such as screen readers) and as the title attribute (supplementary text, often displayed as a tool tip when the mouse is over the image).

See Wikipedia:Image markup with HTML for an old, deprecated, way of putting a caption under the image using HTML code. Please use the new way of associating captions with images, as described on this page.

See Wikipedia:Captions for discussion of appropriate caption text. See Wikipedia:Alternative text for images for discussion of appropriate alt text. Unfortunately, it is not possible to specify different text for these two purposes.

Example

alt text

New syntax for images without caption text displayed underneath, and for thumbnails

The Palace of Westminster

The new syntax is backward compatible, so articles don't have to be changed. Parameters indicating how to render the image can be given, using the syntax [[Image:Westminstpalace.jpg|options|caption text]].

Available options are:

thumbnail, thumb 
generates an automatically resized thumbnail image (either reduced or enlarged, see below), normally on the right, with the caption text displayed directly underneath. An "enlarge"-icon is added. Example: [[Image:Westminstpalace.jpg|thumbnail|The Palace of Westminster]]
right 
make the image right-aligned, can be used with and without specifying thumb
left 
same as above, but left aligned.
center 
same as above, but centred.
none 
The image will be rendered inline, even if the thumbnail-option is set
frame 
The image will have a frame, regardless of whether it is a thumb, and the caption text will be included as a visible caption.
sizepx 
render a version of the image that's [size] pixels wide (e.g. '150px'). Height is computed to keep aspect ratio (i.e. the shape of the image). This allows both size reduction and enlargement. Both the image itself and an icon link to the image description page with the image in its actual size. The link title of the icon is "Enlarge", even in cases where this term does not apply, because it leads from the enlarged image to the one with the actual size.
Note that this does not just change the apparent image size using HTML; it actually generates a resized version of the image on the fly and links to it appropriately. This happens whether or not you use size in conjunction with thumb.


Vertical bars are used to separate options from each other and from the caption text. Unknown options are skipped and the last option is used as the caption text.


Westminstpalace.jpg

Example for an image without caption text displayed underneath:

[[Image:Westminstpalace.jpg|right|]]

The last vertical bar ensures that the alternate text becomes "Westminstpalace.jpg" and not "right".


The options can be combined, e.g. as

Palace of Westminster
Palace of Westminster

[[Image:Westminstpalace.jpg|left|80px|Palace of Westminster]] (shown on the left) or

[[Image:Westminstpalace.jpg|thumb|80px|Palace of Westminster]] (shown on the right).

The option none can be used to have thumbnails without left- or right-alignment. This is probably most useful for tables. This is an example:

How to use none
London's palaces
Palace of Westminster
From the Thames
[[Image:Westminstpalace.jpg|thumb|none|100px|From the Thames]]
Pair of Speedos
Speedos
[[File:Speedos.jpg|thumb|none|100px|Speedos]]

Thumbnail with caption text underneath that has one or more links

From MediaWiki 1.3, it is also possible to include links in the caption text, e.g.:

[[Image:Westminstpalace.jpg|right|thumbnail|This is the Palace of Westminster in London]]

This is the Palace of Westminster in London


Just make sure the number of opening and closing square brackets are right. One extra/missing would mean the entire image syntax line not working.

Cancelling floating-around-image mode

After having had an image floating next to text, putting further text below it and again using the full width can be done with the following markup. This blocks an image from appearing next to the material following this markup, possibly due to aesthetic reasons or a change in topics.

<br style="clear:both;" />

Image galleries

See Wikipedia:Gallery.

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Tools