Help:Images: Difference between revisions
(New page: Copied from [http://www.mediawiki.org/wiki/Help:Images Mediawiki's help page] This page explains the image syntax when editing the wiki. Before using images in your page, your wiki must h...) |
(modified for current File: syntax) |
||
Line 2: | Line 2: | ||
This page explains the image syntax when editing the wiki. Before using images in your page, your wiki must have file uploads enabled and you have to [[Special:Upload|upload a file]]. |
This page explains the image syntax when editing the wiki. Before using images in your page, your wiki must have file uploads enabled and you have to [[Special:Upload|upload a file]]. |
||
Note that wherever the <tt>File:</tt> prefix is used, the legacy <tt>Image:</tt> prefix is still supported as a synonym. |
|||
__TOC__ |
__TOC__ |
||
Line 12: | Line 14: | ||
|Embed image<br /> (with alt text) |
|Embed image<br /> (with alt text) |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Example.jpg|Sunflowers]]</nowiki></code> |
||
| |
| |
||
[[ |
[[File:Example.jpg|Sunflowers]] |
||
|- |
|- |
||
|Link to description page |
|Link to description page |
||
| |
| |
||
<code><nowiki>[[: |
<code><nowiki>[[:File:Example.jpg]]</nowiki></code><br /> |
||
<code><nowiki>[[: |
<code><nowiki>[[:File:Example.jpg|Sunflowers]]</nowiki></code> |
||
| |
| |
||
[[: |
[[:File:Example.jpg]]<br /> |
||
[[: |
[[:File:Example.jpg|Sunflowers]] |
||
|- |
|- |
||
|Link directly to file |
|Link directly to file |
||
Line 34: | Line 36: | ||
|Thumbnail<br /> (centered, 100 pixels<br /> wide, with caption) |
|Thumbnail<br /> (centered, 100 pixels<br /> wide, with caption) |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Example.jpg|center|thumb|100px|Sunflowers]]</nowiki></code> |
||
| |
| |
||
[[ |
[[File:Example.jpg|center|thumb|100px|Sunflowers]] |
||
|- |
|- |
||
|Border<br /> (100 pixels) <br /> Results in a very small gray border |
|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 |
<!-- Note: because the fine gray border can not be seen when used on File:Exaple.jpg (sunflowers image), an image with a white background is used --> |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Example-white-bg.jpg|border|100px]]</nowiki></code> |
||
| |
| |
||
[[ |
[[File:Example-white-bg.jpg|border|100px]] |
||
|- |
|- |
||
|Frameless<br />Like thumbnail, respect user preferences for image width but without border and no right float. |
|Frameless<br />Like thumbnail, respect user preferences for image width but without border and no right float. |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Example.jpg|frameless]]</nowiki></code> |
||
| |
| |
||
[[ |
[[File:Example.jpg|frameless]] |
||
|} |
|} |
||
== Syntax == |
== Syntax == |
||
The full syntax for displaying an image is: |
The full syntax for displaying an image is: |
||
<code><nowiki>[[ |
<code><nowiki>[[File:{name}|{options}]]</nowiki></code> |
||
Where options can be zero or more of the following, separated by pipes: |
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>thumb</code>, <code>thumbnail</code>, <code>frame</code>, or <code>frameless</code>: Controls how the image is formatted |
||
Line 86: | Line 88: | ||
|- |
|- |
||
|colspan=2| |
|colspan=2| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Wiki.png|</nowiki>50px]]</code> |
||
('''no alignment specified''', or default alignment) |
('''no alignment specified''', or default alignment) |
||
text text text text text text text text text text text text text text text |
text text text text text text text text text text text text text text text |
||
[[ |
[[File:Wiki.png|50px]] |
||
text text text text text text text text text text text text text text text |
text text text text text text text text text text text text text text text |
||
|- |
|- |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Wiki.png|</nowiki>50px|'''none''']]</code> |
||
(specify alignment as '''none''') |
(specify alignment as '''none''') |
||
none none none none none none none none none none |
none none none none none none none none none none |
||
[[ |
[[File:Wiki.png|50px|none]] |
||
none none none none none none none none none none |
none none none none none none none none none none |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Wiki.png|</nowiki>50px|'''center''']]</code> |
||
center center center center center center center |
center center center center center center center |
||
[[ |
[[File:Wiki.png|50px|center]] |
||
center center center center center center center |
center center center center center center center |
||
|- |
|- |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Wiki.png|</nowiki>50px|'''left''']]</code> |
||
left left left left left left left left left left |
left left left left left left left left left left |
||
[[ |
[[File:Wiki.png|50px|left]] |
||
left left left left left left left left left left left left left left left left left left left left |
left left left left left left left left left left left left left left left left left left left left |
||
| |
| |
||
<code><nowiki>[[ |
<code><nowiki>[[File:Wiki.png|</nowiki>50px|'''right''']]</code> |
||
right right right right right right right right |
right right right right right right right right |
||
[[ |
[[File:Wiki.png|50px|right]] |
||
right right right right right right right right right right right right right right right right right right |
right right right right right right right right right right right right right right right right right right |
||
|- |
|- |
||
Line 130: | Line 132: | ||
<pre> |
<pre> |
||
<gallery> |
<gallery> |
||
File:{filename}|{caption} |
|||
File:{filename}|{caption} |
|||
{...} |
{...} |
||
</gallery> |
</gallery> |
||
Line 141: | Line 143: | ||
<pre> |
<pre> |
||
<gallery> |
<gallery> |
||
File:Example.jpg|Item 1 |
|||
File:Example.jpg|a link to [[Help:Contents]] |
|||
File:Example.jpg |
|||
File:Example.jpg |
|||
File:Example.jpg|''italic caption'' |
|||
File:Example.jpg|on page "{{PAGENAME}}" |
|||
</gallery> |
</gallery> |
||
</pre> |
</pre> |
||
is formatted as: |
is formatted as: |
||
<gallery> |
<gallery> |
||
File:Example.jpg|Item 1 |
|||
File:Example.jpg|a link to [[Help:Contents]] |
|||
File:Example.jpg |
|||
File:Example.jpg |
|||
File:Example.jpg|''italic caption'' |
|||
File:Example.jpg|on page "{{PAGENAME}}" |
|||
</gallery> |
</gallery> |
||
Latest revision as of 04:02, 28 April 2014
Copied from Mediawiki's 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 and you have to upload a file.
Note that wherever the File: prefix is used, the legacy Image: prefix is still supported as a synonym.
Description | You type | You get |
Embed image (with alt text) |
|
|
Link to description page |
|
|
Link directly to file |
|
|
Thumbnail (centered, 100 pixels wide, with caption) |
|
|
Border (100 pixels) Results in a very small gray border |
|
|
Frameless Like thumbnail, respect user preferences for image width but without border and no right float. |
|
Syntax
The full syntax for displaying an image is:
[[File:{name}|{options}]]
Where options can be zero or more of the following, separated by pipes:
thumb
,thumbnail
,frame
, orframeless
: Controls how the image is formattedleft
,right
,center
,none
: Controls the alignment of the image on the pagebaseline
,sub
,super
,top
,text-top
,middle
,bottom
,text-bottom
: Controls the vertical alignment of the image on the page{width}px
: Resizes the image to the given width in pixels- Special cases:
page=1
: Displays the specified page when showing a djvu file
link={destination}
: Allows to link to an arbitrary title, URL or just nowhere (1.14+)alt={alternative text}
: For changing the alternative text (alt=""
) of an image (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.
(See Mediawiki's help page.)
Size and Frame
Among different frame type, the effect of the size parameter may be different, as shown below.
(See Mediawiki's help page.)
Border and Frame
(See Mediawiki's help page.)
Alignment
Other files
You can link to an external file using the same syntax used for linking to an external web page.
[http://url.for/some/image.png]
Or with different text:
[http://url.for/some/image.png link text here]
If it is enabled on your wiki, you can also embed external images. To do that, simply insert the image's url:
http://url.for/some/image.png
Gallery of images
It's easy to make a gallery of thumbnails only, not other images, with the <gallery>
tag. The syntax is:
<gallery> File:{filename}|{caption} File:{filename}|{caption} {...} </gallery>
Note that the image code is not enclosed in brackets when enclosed in gallery tags.
Captions are optional, and may contain wiki links or other formatting.
for example:
<gallery> File:Example.jpg|Item 1 File:Example.jpg|a link to [[Help:Contents]] File:Example.jpg File:Example.jpg File:Example.jpg|''italic caption'' File:Example.jpg|on page "{{PAGENAME}}" </gallery>
is formatted as:
a link to Help:Contents
Parameters
The gallery tag itself takes several additional parameters:
<gallery {parameters}> {images} </gallery>
caption={caption}
: sets a caption on the gallery.widths={width}px
: sets the widths of the images.heights={heights}px
: sets the (max) heights of the images.perrow={integer}
: sets the number of images per row.