Open main menu

Changes

7,059 bytes added ,  20:18, 10 January 2009
m
→‎Gallery of images: brief gallery parameter descriptions
{{PD Help Page}}

This page explains the image syntax when editing the wiki. Before using images in your page, your wiki must have file uploads enabled (see the {{mediawiki|Manual:Configuring_file_uploads|technical manual}} for details) and you have to [[Help:Managing files|upload a file]].

__TOC__
{| {{Prettytable}}
|-
|{{Hl3}}|'''Description'''
|{{Hl3}}|'''You type'''
|{{Hl3}}|'''You get'''
|-
|Embed image<br /> (with alt text)
|
<code><nowiki>[[Image:Example.jpg|Sunflowers]]</nowiki></code>
|
[[Image:Example.jpg|Sunflowers]]
|-
|Link to description page
|
<code><nowiki>[[:Image:Example.jpg]]</nowiki></code><br />
<code><nowiki>[[:Image:Example.jpg|Sunflowers]]</nowiki></code>
|
[[:Image:Example.jpg]]<br />
[[:Image:Example.jpg|Sunflowers]]
|-
|Link directly to file
|
<code><nowiki>[[Media:Example.jpg]]</nowiki></code><br />
<code><nowiki>[[Media:Example.jpg|Sunflowers]]</nowiki></code>
|
[[Media:Example.jpg]]<br />
[[Media:Example.jpg|Sunflowers]]
|-
|Thumbnail<br /> (centered, 100 pixels<br /> wide, with caption)
|
<code><nowiki>[[Image:Example.jpg|center|thumb|100px|Sunflowers]]</nowiki></code>
|
[[Image:Example.jpg|center|thumb|100px|Sunflowers]]
|-
|Border<br /> (100 pixels) <br /> Results in a very small gray border
<!-- Note: because the fine gray border can not be seen when used on Image:Exaple.jpg (sunflowers image), an image with a white background is used -->
|
<code><nowiki>[[Image:Example-white-bg.jpg|border|100px]]</nowiki></code>
|
[[Image:Example-white-bg.jpg|border|100px]]
|-
|Frameless<br />Like thumbnail, respect user preferences for image width but without border and no right float.
|
<code><nowiki>[[Image:Example.jpg|frameless]]</nowiki></code>
|
[[Image:Example.jpg|frameless]]
|}

== Syntax ==
The full syntax for displaying an image is:
<code><nowiki>[[Image:{name}|{options}]]</nowiki></code>
Where options can be zero or more of the following, separated by pipes:
*<code>thumb</code>, <code>thumbnail</code>, <code>frame</code>, or <code>frameless</code>: Controls how the image is formatted
*<code>left</code>, <code>right</code>, <code>center</code>, <code>none</code>: Controls the alignment of the image on the page
*<code>baseline</code>, <code>sub</code>, <code>super</code>, <code>top</code>, <code>text-top</code>, <code>middle</code>, <code>bottom</code>, <code>text-bottom</code>: Controls the vertical alignment of the image on the page
*<code>{width}px</code>: Resizes the image to the given width in pixels
* Special cases:
** <code>page=1</code>: Displays the specified page when showing a djvu file
*<code>link={destination}</code>: Allows to link to an arbitrary title, URL or just nowhere ([[rev:41727|1.14+]])
*<code>alt={alternative text}</code>: For changing the alternative text (<code>alt=""</code>) of an image ([[rev:41837|1.14+]])

The options can be given in any order. If a given option does not match any of the other possibilities, it is assumed to be the caption text. Caption text can contain wiki links or other formatting.

== Frame ==
The following table shows the effect of all available frame types.

{| {{Prettytable}}
|-
|{{Hl3}}|'''You type'''
|{{Hl3}}|'''You get'''
|-
{{/frame|frame=}}
|-
{{/frame|frame=thumb}}
|-
{{/frame|frame=frame}}
|-
{{/frame|frame=frameless}}
|-
|}

== Size and Frame ==
Among different frame type, the effect of the size parameter may be different, as shown below.

{| {{Prettytable}}
|-
|{{Hl3}}|'''Frame'''
|{{Hl3}} colspan=3|'''You get'''
|-
{{/size|frame=}}
|-
{{/size|frame=thumb}}
|-
{{/size|frame=frame}}
|-
{{/size|frame=frameless}}
|-
|}

== Border and Frame ==

{| {{Prettytable}}
|-
|{{Hl3}}|'''Frame'''
|{{Hl3}} colspan=2|'''You get'''
|-
{{/border|frame=}}
|-
{{/border|frame=thumb}}
|-
{{/border|frame=frame}}
|-
{{/border|frame=frameless}}
|-
|}

== Alignment ==

{| {{Prettytable|width=300px}}
|-
|colspan=2|
<code><nowiki>[[Image:Wiki.png|</nowiki>50px]]</code>
('''no alignment specified''', or default alignment)
text text text text text text text text text text text text text text text
[[Image:Wiki.png|50px]]
text text text text text text text text text text text text text text text
|-
|
<code><nowiki>[[Image:Wiki.png|</nowiki>50px|'''none''']]</code>
(specify alignment as '''none''')
none none none none none none none none none none
[[Image:Wiki.png|50px|none]]
none none none none none none none none none none
|
<code><nowiki>[[Image:Wiki.png|</nowiki>50px|'''center''']]</code>
center center center center center center center
[[Image:Wiki.png|50px|center]]
center center center center center center center
|-
|
<code><nowiki>[[Image:Wiki.png|</nowiki>50px|'''left''']]</code>
left left left left left left left left left left
[[Image:Wiki.png|50px|left]]
left left left left left left left left left left left left left left left left left left left left
|
<code><nowiki>[[Image:Wiki.png|</nowiki>50px|'''right''']]</code>
right right right right right right right right
[[Image:Wiki.png|50px|right]]
right right right right right right right right right right right right right right right right right right
|-
|}

== Other files ==
You can link to an external file using the same syntax used for linking to an external web page.
*<code><nowiki>[http://url.for/some/image.png]</nowiki></code>
Or with different text:
*<code><nowiki>[http://url.for/some/image.png link text here]</nowiki></code>

If it is enabled on your wiki (see {{mediawiki|Manual:$wgAllowExternalImages}}), you can also embed external images. To do that, simply insert the image's url:
*<code><nowiki>http://url.for/some/image.png</nowiki></code>

== Gallery of images ==
It's easy to make a gallery of '''thumbnails only''', not other images, with the <code><nowiki><gallery></nowiki></code> tag. The syntax is:
<pre>
<gallery>
Image:{filename}|{caption}
Image:{filename}|{caption}
{...}
</gallery>
</pre>
Note that the image code is not enclosed in brackets when enclosed in gallery tags. <br>
Captions are optional, and may contain wiki links or other formatting.

for example:
<pre>
<gallery>
Image:Example.jpg|Item 1
Image:Example.jpg|a link to [[Help:Contents]]
Image:Example.jpg
Image:Example.jpg
Image:Example.jpg|''italic caption''
Image:Example.jpg|on page "{{PAGENAME}}"
</gallery>
</pre>
is formatted as:
<gallery>
Image:Example.jpg|Item 1
Image:Example.jpg|a link to [[Help:Contents]]
Image:Example.jpg
Image:Example.jpg
Image:Example.jpg|''italic caption''
Image:Example.jpg|on page "{{PAGENAME}}"
</gallery>

===Parameters===
The gallery tag itself takes several additional parameters:
<pre><gallery {parameters}> {images} </gallery></pre>
* <code>caption={caption}</code>: sets a caption on the gallery.
* <code>widths={width}px</code>: sets the widths of the images.
* <code>heights={heights}px</code>: sets the (max) heights of the images.
* <code>perrow={integer}</code>: sets the number of images per row.

== See also ==
* [[Help:Linked images|Linked images]]

==External Link==
* [[wikipedia:Project:Extended image syntax|Wikipedia:Extended image syntax]]

{{Languages|Help:Images}}

[[Category:Help|Images]]
Anonymous user