Help:Images and other uploaded files

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

If images are uploaded to Wikimedia Commons they can be used in all Wikimedia wikis. Images uploaded on another wiki (e.g. Wikipedia) can only be used in pages of that wiki. More generally a group of wikis may have designated one wiki that is prefered to upload files to, with sharing of those files enabled.

Upload the file under a suitable name, because renaming the file after uploading is not possible. Make sure that the file name has the proper extension. When uploading, a filename can be chosen, so the file name on the wiki doesn't need to be the same as the file name stored on your computer. Also, an upload summary can be written.

When a file is uploaded, an image page (also called "image description page") will be created, with a page name consisting of the file name (including extension), prefixed with "Image:" (or in general the value of variable     ). Thus the file names are case-sensitive (this applies even for the file name extension) except, in most wikis, for the first character. Images can also be resized to fit better within a wiki, see below

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

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

(Below "image" can be read as "file", though some complications, like duplicate names blocking access, are specific for embedding images.)

When replacing or deleting an image on Commons, all projects that use the image are affected. Therefore it is important that the image page on Commons is linked to the local image pages of that image on all projects that use it. On these, even if they have never been created explicitly and therefore have an empty editable part, the "image links" section shows the local pages that use the image.

Choose a name for an image as carefully as you would choose an article name, and use proper spacing and capitalization: the name may not be visible in a page that embeds the image, but it is, for example, on the page for a category that contains the image.

When choosing a name for an image on Commons, do not use a name that is already in use on any project on which the image may be used, unless the new image should replace the local ones, and the local ones will therefore be deleted.

Uploading an image locally has the following disadvantages:
 * it can not be used in other projects
 * an existing or future image with the same name on Commons is not accessible for embedding in the local project

Thus this should be done only if there is a special reason for it, such as locally replacing an image from Commons with a local version without changing the links.

Linking
To link to an uploaded file, e.g. Flag of Somalia.svg, use [[Media:Flag of Somalia.svg]] instead of, giving [[Media:Flag of Somalia.svg]]; to link to the image description page, use Image:Flag of Somalia.svg , giving Image:Flag of Somalia.svg (the first colon is not displayed).

Piped links work as usual.

Existence detection, with a link to the edit page if the page does not exist, works as usual, but is applicable for the image page, not the image.

Interwiki linking 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.

For using an image as a link to another document, see Help:Navigational image.

In the case of non-image uploads, e.g. office files (if allowed by the system), the keyword 'media' is used even though office documents are not typically classed as media, in the context of audio/video etc.

Embedding internal images
"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. If neither exists a link to the upload page appears, with class="new" ("red link"). The link is rendered the same as one to the edit page of the non-existing image page, except that the former shows the canonical form of the pagename.

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

An embedded internal image automatically links to the image page, which shows the full image, or, depending on preferences, a reduced version with a link to the full version. The page also provides info about the image.

gives

gives

gives

gives (see on the right):

To add the uploaded image to an article as a thumbnail, one can use  or. or .

In the latter case the image will keep its original aspect ratio: either the width or the height will be equal to the specified maximum, whichever allows the other to be <= the maximum.

The default thumbnail width can be set in the preferences, so typically it is better not to specify "px", in order to respect the users' preferences (unless, for a special reason, a specific size is required regardless of preferences, or a size is specified outside the range of widths 120-300 that can be set in the preferences).

The caption can contain links. Both the image itself and an icon link to the image page. The icon has the link title "Enlarge" in its hoverbox, even in cases where the image on the image page is smaller. Depending on preferences the image on the image page may be smaller than the thumbnail image, so a link may be convenient from the thumbnail straight to the image in actual size. E.g.



'''For more possibilities, see en:Wikipedia:Extended image syntax. Also, the source of existing pages with images are useful as examples.'''

Image at the left
  puts the image at the left; text that follows floats to the right of it; if a second image immediately comes after the first, the second abuts to the right side of the first; if there is text in between then the second image is at the lower right of the first, under this text:

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. between the 3rd and 4th images. ''Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.'' after the 4th image.

With   the image is put at the left, and text that follows starts below it.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent lupta

Image at the right
  puts the image at the right; text that follows floats to the left of it. The situation is not symmetric with the case above: a second image is put at the extreme right again, under the first.

First image just before this ''zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.''  second image just before this.

It is, however, possible to make them behave similarly to the image at the left example with the following format:


 * {|align="right"


 * |[[image:tst.png|right|thumb|50px|[[help:contents|demo]]]]


 * |}

For instance:
 * {|align="right"


 * |[[image:tst.png|right|thumb|50px|[[help:contents|demo]]]]


 * |}


 * {|align="right"


 * |[[image:tst.png|right|thumb|50px|[[help:contents|demo]]]]


 * |}


 * text after the first two of the three
 * {|align="right"


 * |[[image:tst.png|right|thumb|50px|[[help:contents|demo]]]]


 * |}

gives:

text after the first two of the three

Using full width again
Use  , or on projects that have Template:Clr (Meta and en:):. Text floats around the image until it gets to (in Meta) like this.After , however, text can float no longer, and restarts from under the image, using the full width again like this,...... like this, like this, like this, like this, like this, like this, like this.

Text overlapping other text or image
When a text floats around an image and either a text or another image, one line of the floating text may overlap the top of the second item (try multiple character sizes to see the effect):

This text may overlap the text which is supposed to float right to it. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

This effect is not specific for images, but is related to the non-integer height in terms of lines, of the first item:

This text may overlap the text which is supposed to float right to it. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

A remedy if the second item is a text is to prefix , and if it is an image, to apply a top margin of one line height. For example, for an image at the right we can add the CSS "div.tright { margin-top:1em;}".

An image in a table
The parameters "left" and "right" may give complications inside a table (and may not be needed anyway), depending on the browser. In IE the first table sometimes (!) displays text through the image:

Inline images
Inline images cannot have a caption, but they can have a "title"-attribute (often misidentified as the "alt" attribute, which has a different purpose), which is 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 none; 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 and enlarged.

Example (note the hoverbox too): text text text text gives

text text  text  text

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


 * [[Image:Tile Hill train 550.jpg]]

Image:Tile Hill train 550.jpg
 * Image:Tile Hill train 550.jpg

[[Media:Tile Hill train 550.jpg]]
 * [[Media:Tile Hill train 550.jpg]]

train
 * external, with label: train


 * external, footnote style:


 * external, just the URL: http://en.wikipedia.org/upload/d/d1/Tile_Hill_train_550.jpg http://en.wikipedia.org/upload/d/d1/Tile_Hill_train_550.jpg

Gallery tag, category, table of images
The gallery-tag is a quick way to show thumbnails in a number of columns.

Each entry is of the form "Image:image name or "Image:image name|caption, possibly with links". The gallery-tag also allows text to take the position of an image.

It is possible to give a title to the gallery with the "gallery caption" parameter.

The width of the table is determined by the width per image and the number of images per row ("perrow" parameter), which can both be set.

Also the image height can be set. The height of the caption depends on the image width and varies per image with the length of the caption. The height of each table row is the maximum height needed in that row for an image with a caption.

Example:

Note that, with the gallery tag, the images have a single fixed width.

The resulting HTML is that of a table with class="gallery", with cells with class="gallerybox".


 * See also w:Wikipedia:Gallery.

Galleries in categories

A gallery of images in on a category page is automatically shown as the fourth section of this category page. The first 20 characters of the image name are shown, with dots if that is not the full name. Both the image and the name link to the image page, instead of just the image. No alternative text or other links are possible. The file size is also shown.


 * For a comparison, see commons:Category:William-Adolphe Bouguereau.

Tables

Using table syntax, with images in separate cells, and the image syntax explained elsewhere on this page, gives more control over size, layout, captions, etc. than each of these two methods. However, only a category page automatically gives file sizes.

Example of an image table:

gives:

Note that, with this method, each image has a width specified by the size option, if any, and a height depending on whether there is caption or not, and how long the caption is. The width of a column is determined by the widest image in it, and the height of the row is determined by the tallest image in it.


 * See also.

Square monitors
To format for a square monitor or window, use a tape measure. Determine the height of your rectangular screen. Using that figure measure under the screen to determine the width your monitor’s screen would be if it were square. Mark that location using ink or tape under the screen. Drag the side of your browser’s window to that location so the window is square based on accurate measurements. Square monitors and reading windows are not able to contain tables and galleries made for rectangular and wide screens. When a table or gallery is wider than the monitor, it makes every line of text wider than the screen as well. The px amounts of the following gallery were determined after measuring the window to make sure it was square:

Type this:



For this:

Navigational maps
Navigational maps like  have map areas linked to pages. The html with tags can not be put in the wikitext. However, there are the following possibilities:
 * With ImageMap (MW 1.9+) you can define areas in an image and link to wiki pages when clicking on that area.
 * EasyTimeline allows the creation of an image and a page embedding that image, with rectangular map areas defined by tags 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 label 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.
 * One can divide an image in rectangles, like in these chess and go positions, or superimpose an area with images (see above) and link each rectangle/image to the desired target by means of a redirect on the image page (provided that the target is internal).

See also:
 * Help:Composite images - Allows superimposing a linked text onto an image.
 * Map of Downtown Ottawa, Wellington Street.

Example using ImageMap
Example: Output of this example:

See also:
 * en:Category:Wikipedia imagemaps
 * nl:Categorie:Wikipedia:Imagemap

Examples using EasyTimeline
Example 1

gives

Example 2

gives

Alternatives
Some attempts for other alternatives (note the hover boxes):

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:

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

With labels:

See also Maps, Maps' clickability.

Uploading
Before uploading please ensure that you have rights to upload and redistribute the image(s) in question, and that they comply with any further licensing requirements of the Wikimedia Commons project and other criteria for inclusion.

In the menu on the left under "toolbox" you will have a link named "Upload file". On the following page 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 file" 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 with millions of colors and shades; PNG for fixed-color pixelated images such as icons; SVG for structured drawings, logos; and OGG for audio. 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 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 Coordinated Universal Time 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.


 * Last 50 uploaded files
 * MediaWiki file usage - technical notes

Supported file types
Apart from text, MediaWiki supports the following media inline:
 * images -- preferred formats: PNG, JPEG, GIF.

Currently the following file types can be uploaded:


 * 'png', 'gif', 'jpg'/'jpeg', 'ogg'.

For security reasons some file types that could be uploaded in the past can no longer be uploaded, but the files already uploaded can still be used.

SVG images uploaded earlier can be linked to, but not be directly embedded, e.g. [[Media:Wikipedia3fnlc1.svg]] (image description page) - see also SVG image support.

There may be a size limit, the largest one is: 6.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 file types other than .jpg or .ogg, e.g., .pdf, in newer versions of mediawiki, you have to modify the file LocalSettings.php by copying the variable and its contents from DefaultSettings.php. Afterward, you can edit it accordingly: $wgFileExtensions = array( 'png', 'jpg', 'jpeg', 'ogg','doc','xls','ppt','mp3','sxc','pdf' );

You may also need to remove this extension from the filetype blacklist (in /includes/DefaultSettings.php).

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:
 * Formulas (e.g. The sum of squares of integers from 1 to N)
 * Timelines, navigational maps, etc. (e.g. Soviet Leaders)
 * thumbnails of uploaded images (e.g. An image from The Canterbury Tales]) (saves bandwidth compared with letting the browser do the reduction)

For tables the system produces HTML, not an image file, but some tables are effectively images produced by the browser, e.g. if the cells are empty colored boxes. Example: see m:Template talk:Rectangle 8x8.

Uploading non-image files
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 types, 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

Even better, add your extension to the $wgFileExtensions array, so that any future changes in DefaultSettings.php get propagated up to your code: $wgFileExtensions[] = 'zip';

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' );

You may find that PHP and Apache also limit the filesize of uploads, giving spurious messages on the upload page such as "The file you uploaded seems to be empty. This might be due to a typo in the file name. Please check whether you really want to upload this file." See Q: What affects the maximum file size which can be uploaded? on this page for details: http://meta.wikimedia.org/wiki/Uploading_files#Frequently_Asked_Questions. (It might be better to have this information conglomerated more centrally).

Troubleshooting File upload
In case you get The file is corrupt or has an incorrect extension. Please check the file and upload again. , when trying to upload a file, someone tried:
 * Already had LocalSettings.php updated to include odt in Mediawiki 1.7.1 on ubuntu 6.06 lts
 * tried renaming file to blah.gif, it didn't make it work, tried an image file and that worked
 * no solution / try a newer version?
 * Check your php variables : upload_max_filesize and post_max_size.

Adding $wgVerifyMimeType = false; in LocalSettings.php is a work-around. Please consider the security risk involved.

Template for showing links to files with appropriate icons
For a template to enable files to be shown as links with relevant icons, as well as a link to the file's wiki page, see here.

This is for wikis that support embedding external images - which is most personal, corporate and organizational wikis based on MediaWiki. Notable exceptions are Wikipedia and Meta. Because Meta can't render this template, here is an image of how the template appears:

Revision history of pages containing images
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
Here are the default settings shown in. $wgFileExtensions = array( 'png', 'jpg', 'jpeg', 'ogg' );
 * 1) This is the list of preferred extensions for uploading files. Uploading
 * 2) files with extensions not in this list will trigger a warning.

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

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

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

$wgUploadSizeWarning = 150000;
 * 1) Warn if uploaded files are larger than this

Protection
Images on MediaWiki:Bad image list cannot be embedded; they appear as a regular link to the image page. Exceptions to allow a listed image on particular relevant articles can be added. See, for example, w:en:MediaWiki:Bad image list.

Protection of an image page is automatically also protection of the image itself: i.e. a new image under the name of the existing image can only be uploaded by a sysop.

Embedding external images
External images can not always be embedded, this depends on the settings of the project: it has been disabled on Meta and many Wikipedias, including the English and German, to prevent vandalism and "bandwidth theft" from other sites, but it is still allowed on some wikis.

If enabled in DefaultSettings.php $wgAllowExternalImages = true; on this project there is an image here, otherwise just a link to an image: http://en.wikipedia.org/upload/b/bc/Wiki.png

The wiki markup text used for this image is simply the raw url of the image, ie http://en.wikipedia.org/upload/b/bc/Wiki.png. It can be shown in actual size only.

If necessary, download an image of a project and upload a copy into the Commons project (provided it's freely licensed and not used under fair use), you can then use it on all projects.

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

To use an image as a link to a specified page (either external URL or an internal wiki page) see navigational image.

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/alphanumerics/alphanumerics/" with "wiki/image:".

For inline images, put the url, preceded and followed by a space, in the text: a http:// upload.wikimedia.org/wikipedia/commons/2/27/Tst.png b gives a http://upload.wikimedia.org/wikipedia/commons/2/27/Tst.png b

Without special formatting, images are positioned inline to text, 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.

gives

WikiTeX
WikiTeX is a MediaWiki extension that can produce graphs of functions, various diagrams, etc. It is operational at http://wikisophia.org/, but not yet at Wikimedia projects. Note that one can anyway produce an image on Wikisophia, and subsequently upload it on any MediaWiki project.