Jump to content

Help:Images and other uploaded files

From Wikisource
Help:Images and other uploaded files

To add an image, the image file has to be uploaded. Also other files can be uploaded, see below. The system uses the term "image" for any uploaded file.

First give the file a suitable name, because renaming during or after uploading is not possible. Make sure that the file name has the proper extension.

With the file an image description page will be associated, with a page name consisting of the file name (including extension), prefixed with "Image:" (or in general the value of variable {{ns:Image}}). Thus the file names are case-sensitive (this applies even for the file name extension) except, in most projects, for the first character.

If you want to replace an existing file, give it the same name, and otherwise a name that does not exist yet.

Upload it using the Special:Upload link in the system bar (usually to the left of the page). By default, MediaWiki users who are logged in can upload files.

Apart from text, MediaWiki supports the following media inline:

There may be a size limit, the largest one on en: is 3.5 megabytes (but please be reasonable).

The most common is:

  • sound -- preferred format: Ogg Vorbis.

If you want to upload other file types then .jpg or .ogg (like for example .pdf) in newer versions of mediawiki, you have to modify the file includes/DefaultSettings.php accordingly: $wgFileExtensions = array( 'png', 'jpg', 'jpeg', 'ogg','doc','xls','ppt','mp3','sxc','pdf' );

Remarks:

  • Wikimedia specific: see Video policy
  • for reasons of security executable programs are not allowed by default

Suggestions for future formats include:

Linking

[edit]

To link to the file use "Media:" instead of "Image:", e.g. Media:So.gif, to link to the image description page use ":Image:", giving Image:So.gif (the first colon is not displayed).

Piped links work as usual.

Interwiki link style gives a link to the image description page. For embedding (if possible, see below) and linking to the file itself, use external link style.

If interlanguage links would be applicable, use a colon in front of the language code, e,g. [[:de:Bild:Europa-Pos.png]], to avoid the link being put in the margin.

External link syntax is as usual. However, if you want a link to an image proper on a page of a project that allows embedded external images, use a bracketed link syntax and not just the URL, to prevent embedding.

Embedding internal images

[edit]

Only images proper can be automatically presented, sound is not automatically played.

To add the uploaded image to an article, write something like

b

To embed an image, one can use [[Image: image name including extension |thumb|width in pixels px|caption]], e.g. [[image:tst.png|thumb|30px|[[a|b]]]] which gives the image on the right. The caption can contain links.

This format 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.

For more possibilities, see . Also, the source of existing pages with images are useful as examples.

Image at the left

[edit]

[[image:tst.png|left|thumb|50px|[[help:contents|demo]]]] puts the image at the left; text that follows floats around it; a second image immediately after the first is put to the right of it, if there is text in between then the second image is at the lower right of the first, under this text:

demo
demo
demo

text text text text text text text text text text text text text text text text

demo

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 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

Template:Clr With [[image:tst.png|none|thumb|50px|[[help:contents|demo]]]] the image is put at the left, and text that follows starts below it.

demo

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

Image at the right

[edit]

[[image:tst.png|right|thumb|50px|[[help:contents|demo]]]] puts the image at the right; text that follows floats around it. The situation is not symmetric with the case above: a second image is put at the extreme right again.

demo

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

demo

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 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 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 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 text text text

Using full width again

[edit]

Use <br style="clear:both;">, or on projects that have Template:Clr (Meta and en:): {{clr}}.

Inline images

[edit]

Inline images cannot have a caption, but they can have an "alt"-attribute, e.g. shown in the hoverbox (in the cases above, for the image it is the same as the caption, and for the enlarge icon it is "Enlarge"). It is the last item of the image code, hence, if there is only the image name with prefix "image:" it gives that; if there is an empty item by ending with a pipe character it gives the name without prefix; otherwise, it gives the image code item that happens to be last, unless a proper text is specified.

The size of the images can be reduced but they can not be enlarged.

text [[image:tst.png]] text [[image:tst.png|5px|]] text [[image:tst.png|500px|demo]] text

gives: text text text demo text (also note the hoverbox).

See also below.

Embedding external images

[edit]

External images can not always be embedded, this depends on the settings of the project: it has been disabled on many of the larger Wikipedias, including the English and German, to prevent vandalism and bandwidth theft from other sites, but it is allowed on many other Wikimedia projects, including Meta and the Dutch Wikipedia.

If enabled on this project there is an image here, otherwise just a link to an image: http://en.wikipedia.org/upload/b/bc/Wiki.png

If necessary, download an image of a project and upload a copy into the other project. If you want to use an image on e.g. the English and the Dutch Wikipedia, upload it on the English, then you can use it on the Dutch as well. However, in that case extended image syntax is not available, and no automatic link to the image description page. See e.g. .

See also m:Sharing images across projects (ideas).

The examples in what follows are intended for projects in which embedding is enabled.

If enabled, use unbracketed external link style, i.e. just the URL (of the image itself, not of the image description page), e.g. http://en.wikipedia.org/upload/d/d1/Tile_Hill_train_550.jpg. The URL can be found by checking with your browser the properties of the image when it is displayed on a webpage.

Conversely, to go to the image description page of an image referred to with external link style, put the URL in the address bar and replace "upload/number/number/ " with "wiki/image:".

For inline images, put the url, followed by a space, in the text: ahttp://meta.wikimedia.org/upload/2/27/Tst.png b gives ahttp://meta.wikimedia.org/upload/2/27/Tst.png b

Without special formatting, inline images are positioned like this:

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 text text text text text text text text text text text text text text text text text text text text text http://en.wikipedia.org/upload/b/bc/Wiki.png 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 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 text

A table may be used to position the image(s) as desired. E.g.

{| 
| http://en.wikipedia.org/upload/b/bc/Wiki.png
| 
| http://en.wikipedia.org/upload/b/bc/Wiki.png
|-
|
| http://en.wikipedia.org/upload/b/bc/Wiki.png
|
|}

gives

http://en.wikipedia.org/upload/b/bc/Wiki.png http://en.wikipedia.org/upload/b/bc/Wiki.png
http://en.wikipedia.org/upload/b/bc/Wiki.png

Similarly

http://meta.wikimedia.org/upload/2/27/Tst.png http://meta.wikimedia.org/upload/2/27/Tst.png http://meta.wikimedia.org/upload/2/27/Tst.png
http://meta.wikimedia.org/upload/2/27/Tst.png http://meta.wikimedia.org/upload/2/27/Tst.png
http://meta.wikimedia.org/upload/2/27/Tst.png http://meta.wikimedia.org/upload/2/27/Tst.png http://meta.wikimedia.org/upload/2/27/Tst.png
[edit]

Navigational maps like [1] have map areas linked to pages. The html with <area> tags is currently not allowed with the software.

Some attempts for alternatives (note the hover boxes):

o
o
o

Ascii art map, with both the city outline and the label clickable:

    x
   xxx Leiden
    x
 xx
xxxx The Hague
xxx
        xx
       xxxxx Rotterdam
        xxxx

When external images can be embedded:

http://meta.wikimedia.org/upload/2/27/Tst.png
http://meta.wikimedia.org/upload/2/27/Tst.png
http://meta.wikimedia.org/upload/2/27/Tst.png

The html titles are "w: Leiden", etc., the alt attribute is "Tst.png". Opera shows the title in the hoverbox, and also the url, IE only shows the alt.

With labels:

http://meta.wikimedia.org/upload/2/27/Tst.png Leiden
http://meta.wikimedia.org/upload/2/27/Tst.png The Hague
http://meta.wikimedia.org/upload/2/27/Tst.png Rotterdam

See also m:Maps, m:Maps' clickability.

Uploading

[edit]

On most browsers, you will see a "Browse..." button, which will bring up your operating system's standard file open dialog. Choosing a file will fill the name of that file into the text field next to the button. You must also check the box affirming that you are not violating any copyrights by uploading the file. Press the "Upload" button to finish the upload. This may take some time if you have a slow internet connection.

The preferred formats are JPEG for photographic images, PNG for drawings and other iconic images, and OGG for sounds. Please name your files descriptively to avoid confusion.

Please note that as with wiki pages, others may edit or delete your uploads if they think it serves the project, and you may be blocked from uploading if you abuse the system.


When a file is uploaded with the same name as an existing one, the old one is replaced. If that is not the intention one has to check in advance that the same name does not exist yet, because currently the system does not warn against overwriting. For example, click on http://meta.wikipedia.org/wiki/Image:A and replace the A in the address bar of the browser with the file name. Alternatively use the search feature in Special:Imagelist.

When a media file is replaced by uploading a new one with the same name (e.g. an image in an article is replaced), this does not show up in the page history of the article, nor in the Related Changes of the article, nor in the revision history of the image description page (unless the description section is also changed). However, it is recorded in the Image History section of the image description page, and it changes meta:Upload log. Therefore, to watch changes in images in an article, it is not sufficient to watch the article itself and the image description pages ("watching" in the sense of putting on the list of "watched pages"), but one should watch the Upload log also.

Special:Imagelist provides the same information as the Upload log, but it uses the user's local time instead of the default time (set to UTC for Wikimedia projects). In addition it gives the file sizes. Further it allows loading of portions and sorting by size in addition to sorting by date, and it has not only links to the image description pages, but also directly to the images.

Uploading non-image files

[edit]

By default, MediaWiki only allows you to upload certain types of files (extensions gif, jpg, jpeg, ogg and png). This is managed by this order in includes/DefaultSettings.php:

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ogg' );


If you want to be able to upload other file typs, for instance ZIP files you must add this line to LocalSettings.php:

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ogg', 'zip');

Caution: do not modify the line in DefaultSettings.php because it will break when updating


Take in account there is a blacklist of file extensions in includes/DefaultSettings.php:

$wgFileBlacklist = array(
# HTML may contain cookie-stealing JavaScript and web bugs
'html', 'htm',
# PHP scripts may execute arbitrary code on the server
'php', 'phtml', 'php3', 'php4', 'phps',
# Other types that may be interpreted by some servers
'shtml', 'jhtml', 'pl', 'py',
# May contain harmful executables for Windows victims
'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );

More details and examples on embedding internal images into articles

[edit]

To include the image in a page, use a link in the form [[image:file.jpg]] or [[image:file.png|alt text]] or [[media:file.ogg]] for sounds.

Example: Using [[Image:Canterbury_Tales.png]], the image Canterbury_Tales.png is included:

If the wiki is set to another language than English, the name of the "Image:" namespace might be changed. For German, for example, it's [[Bild:Canterbury_Tales.png]]

Alternate Text

[edit]

By specifying alternate text, you can make the article accessible to the blind, too. You can specify an alternate text after a "|"-sign, e.g. [[Image:Canterbury_Tales.png|An old medieval drawing showing many people sitting around a large table]], which will look like this:

An old medieval drawing showing many people sitting around a large table

Layout and resizing

[edit]

Several options can be set when including an image. Those affect the placing of the image, its size or the way the image will be presented. Those options are specified between the image name and the alternate text: [[Image:Canterbury_Tales.png|options|alternate text]]. Available options are:

An image from the canterbury tales
thumbnail, thumb
generates an automatically resized image, normally on the right, with the caption text displayed directly underneath. An "enlarge"-icon is added. Example: [[Image:Canterbury_Tales.png|thumbnail|An image from the canterbury tales]]
right
make the image right-aligned, can be used with and without specifying thumb
left
same as above, but left aligned.
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 thumbnail version of the image that's [size] pixels wide (e.g. '150px'). Height is computed to keep (i.e. the shape of the image).

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.

An old medieval drawing showing many people sitting around a large table

The options can be combined, e.g. as [[Image:Canterbury_Tales.png|left|80px|An old medieval drawing showing many people sitting around a large table]] (shown on the left).

Demo

[edit]

Below one can see the result of the three types of internal link style and external link style on this project. To test this in another project, copy the wikitext there. If applicable, check also the interlanguage links at the margin of the page. Note that some links go to the image description page, others just to the image itself.

  • [[en:Image:Tile Hill train 550.jpg]]
  • [[:en:Image:Tile Hill train 550.jpg]]

en:Image:Tile Hill train 550.jpg

  • [[en:Media:Tile Hill train 550.jpg]]
  • external, with label: [http://en.wikipedia.org/upload/d/d1/Tile_Hill_train_550.jpg train]

train

  • external, footnote style: [http://en.wikipedia.org/upload/d/d1/Tile_Hill_train_550.jpg]

[2]

Revision history of pages containing images

[edit]

Pages in the stored page history consist of wikitext with possible references to templates and images. When viewing an old version of a page, these refer to the current versions of the templates and images, if these still exist. Thus the former composite page is not reconstructed.

Default settings

[edit]

[3]

This is the list of preferred extensions for uploading files. Uploading
# files with extensions not in this list will trigger a warning.
$wgFileExtensions = array( 'png', 'jpg', 'jpeg', 'ogg' );

# Files with these extensions will never be allowed as uploads.
$wgFileBlacklist = array(
	# HTML may contain cookie-stealing JavaScript and web bugs
	'html', 'htm',
	# PHP scripts may execute arbitrary code on the server
	'php', 'phtml', 'php3', 'php4', 'phps',
	# Other types that may be interpreted by some servers
	'shtml', 'jhtml', 'pl', 'py',
	# May contain harmful executables for Windows victims
	'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );

# This is a flag to determine whether or not to check file extensions on
# upload.
$wgCheckFileExtensions = true;

# If this is turned off, users may override the warning for files not
# covered by $wgFileExtensions.
$wgStrictFileExtensions = true;

# Warn if uploaded files are larger than this
$wgUploadSizeWarning = 150000;

Linking to an enlarged image

[edit]

Unfortunately, when linking to an image, no parameters can be specified except the link label, e.g. bullet). Also, when linking to a template instead of embedding it, transfer of parameters is not possible.

Thus one cannot link to an enlarged image unless one has prepared a page containing that enlarged image, e.g. help:tst.png (large). The large image has been put here in the Help namespace, alternatively it could have been in;

  • the image description page (in that case some scrolling is required to see the image history and the pages using the image, but this can be made more convenient with a TOC)
  • its talk page (ditto, to see the talk)
  • a separate page in the image name space, like Image:Tst.png (large).

Also, when linking to a template instead of embedding it, transfer of parameters is not possible. This would have been useful e.g. to link to an enlarged image.

See also

[edit]