Jump to content

Help:Images and other uploaded files

From Wikinews, the free news source you can write!
This is a copy of m:Help:Images and other uploaded files using Wikinews-specific templates. Don't edit this page, except to replace the contents with the current version of that master page. To make changes applicable on all projects, edit the master page; to change Wikinews-specific content, edit the templates; to make demos work, copy templates to this project, and images to Wikimedia Commons. Please see the history of the master page for author details. Please note that all meta content is licensed under the GFDL. As a result this page is licensed under the GFDL. - Edit this template

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 "File:" (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.


Although on each projects files can be uploaded, a family of projects may have designated one in particular for this, with sharing of those files enabled. For Wikimedia projects this is Wikicommons (free content only, no "fair use" content), in general this is referred to below as Commons.

To upload a file, go to Commons, log in there, and upload the file using the Upload link.

If you want to replace an existing file, give it the same name, and otherwise a name that does not exist yet. Be careful with replacing or deleting an image on Commons, a complication is that the "Image links" section on the image description page on Commons does not show usage of the image by other projects.

Apart from text, MediaWiki supports the following media inline:

  • images -- preferred formats: PNG, JPEG.

Currently SVG images can be uploaded and linked to, but not be embedded, e.g. File:Wikipedia3fnlc1.svg (image description page) - see also SVG image support.

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

The most common type of media apart from images 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 LocalSettings.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

Images can also be produced by the system from specifications in wikitext:

Linking

[edit]

To link to the file use ":File:" instead of "File:", e.g. File: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]

"Internal" refers to both the same project and Commons. An image name is assumed to refer to the one in the same project if it exists there, otherwise to one on Commons.

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

b

To add the uploaded image to an article, write something like [[File:tst.png|thumb|30px|[[a|b]]]]

To embed an image, one can use [[File: image name including extension |thumb|width in pixels px|caption]], e.g. [[File: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 Extended image syntax. Also, the source of existing pages with images are useful as examples.

Image at the left

[edit]

[[File: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

With [[File: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]

[[File: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:Clear (Meta and en:): {{clear}}.

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 "File:" 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 [[File:tst.png]] text [[File:tst.png|5px|]] text [[File: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

Currently the following public MediaWiki wikis do not allow external images:

  • English Wikipedia

If necessary, download an image of a project and upload a copy into the Commons project, you can then use it on all projects.

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/File:".

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 [4] have map areas linked to pages. The HTML with <area> tags can not be put in the wikitext. However, EasyTimeline allows the creation of an image and a page embedding that image, with <area> tags for rectangular map areas in the HTML. The title of a link to a non-internal page is only the domain name, e.g. "en.wikipedia.org/..". The length and width of the rectangle can not be controlled, except that it depends on the length of the link lable and its font size. In case of overlap of rectangles one has to look at the hoverbox or statusbar to avoid following the wrong link. In case of much overlap it may not be possible to use all links.

Examples:

en.wikipedia.org/..en.wikipedia.org/..en.wikipedia.org/..en.wikipedia.org/..
<timeline>
ImageSize  = width:400 height:150
PlotArea   = width:400 height:150 left:0 bottom:0
TimeAxis  = orientation:vertical # dummy, required
Period    = from:0 till:1 # dummy, required
Define $s = fontsize:XL
TextData  =
  pos:(50,120) $s text:[http://en.wikipedia.org/wiki/Leiden|o Leiden]
  pos:(150,110) $s text:[http://en.wikipedia.org/wiki/Alphen%20aan%20den%20Rijn|o Alphen aan den Rijn]
  pos:(10,80) $s text:[http://en.wikipedia.org/wiki/The%20Hague|o The Hague]
  pos:(50,40) $s text:[http://en.wikipedia.org/wiki/Rotterdam|o Rotterdam]
</timeline>
en.wikipedia.org/..en.wikipedia.org/..en.wikipedia.org/..en.wikipedia.org/..
<timeline>
Preset     = TimeHorizontal_AutoPlaceBars_UnitYear
ImageSize = width:500 barincrement:50
Period     = from:0 till:12
BarData=
  bar:a
  bar:b
  bar:c
Define $s = fontsize:XL
BackgroundColors = canvas:white
PlotData=
  width:20
  shift:(45,-5)
  bar:a from:3 till:4 $s text:[http://en.wikipedia.org/wiki/Leiden|Leiden]
  bar:a  from:6 till:7 $s text:[http://en.wikipedia.org/wiki/Alphen%20aan%20den%20Rijn|Alphen aan den Rijn]
  bar:b  from:1 till:2 $s text:[http://en.wikipedia.org/wiki/The%20Hague|The Hague]
  bar:c  from:3 till:4 $s text:[http://en.wikipedia.org/wiki/Rotterdam|Rotterdam]
</timeline>

Some attempts for other 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/File: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 [[File:file.jpg]] or [[File:file.png|alt text]] or [[File:file.ogg]] for sounds.

Example: Using [[File:Canterbury Tales.png]], the image Canterbury Tales.png is included:

If the wiki is set to another language than English, the name of the "File:" 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. [[File: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: [[File:Canterbury Tales.png|options|alternate text]]. Available options are:

An image from the Canterbury tales
thumbnail, thumb
generates an automatically resized thumbnail image, normally on the right, with the caption text displayed directly underneath. An "enlarge"-icon is added. Example: [[File: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 aspect ratio (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 [[File: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.

  • [[w:File:Tile Hill train 550.jpg]]

w:File:Tile Hill train 550.jpg

  • [[:w:File:Tile Hill train 550.jpg]]

w:File:Tile Hill train 550.jpg

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

en:File: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]

[5]

Revision history of pages containing images

[edit]

Pages in the stored Help: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]

[6]

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 File: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]
[edit]
Help contents

Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | New page | Images/files | Image description page | Special characters | Formula | Table | EasyTimeline | Template | Renaming (moving) a page | Automatic conversion of wikitext | Talk page | Testing || rlc | Meta | Wikibooks | Wikicommons | Wikipedia | Wikiquote | Wikisource | Wiktionary

This is a copy of m:Help:Images and other uploaded files using Wikinews-specific templates. Don't edit this page, except to replace the contents with the current version of that master page. To make changes applicable on all projects, edit the master page; to change Wikinews-specific content, edit the templates; to make demos work, copy templates to this project, and images to Wikimedia Commons. Please see the history of the master page for author details. Please note that all meta content is licensed under the GFDL. As a result this page is licensed under the GFDL. - Edit this template