Help:Images and other uploaded files

From MozillaWiki
(Redirected from Help:Image)
Jump to: navigation, search

MozillaWiki Handbook
Software help for MozillaWiki — see page histories for older versions.
Handbook Contents | Other help

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.


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. Media: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

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

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

To add the uploaded image to an article, write something like [[image:tst.png|thumb|30px|[[a|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 en:Wikipedia:Extended image syntax. Also, the source of existing pages with images are useful as examples.

Image at the left

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

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 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 [[image:tst.png|none|thumb|50px|[[help:contents|demo]]]] the image is put at the left, and text that follows starts below it.

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

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

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

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

Inline images

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 Tst.png text Tst.png text demo text (also note the hoverbox).

See also below.

Embedding external images

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.

If enabled on this project there is an image here, otherwise just a link to an image: 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/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 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

Wiki.png Wiki.png
Wiki.png

Similarly

Tst.png Tst.png Tst.png
Tst.png Tst.png
Tst.png Tst.png Tst.png

Navigational maps

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:

<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:Leiden
 pos:(150,110) $s text:Alphen aan den Rijn
 pos:(10,80) $s text:The Hague
 pos:(50,40) $s text:Rotterdam

</timeline>

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

<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:[5]
 bar:a  from:6 till:7 $s text:aan den Rijn
 bar:b  from:1 till:2 $s text:Hague
 bar:c  from:3 till:4 $s text:[6]

</timeline>

<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

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

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

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:

File:Canterbury Tales.png

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

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

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:

File:Canterbury Tales.png
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: [[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 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.

File:Canterbury Tales.png
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

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:Image:Tile Hill train 550.jpg

  • [[en:Media: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]

[7]

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

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

[8]

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

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.

Linking an image to another wiki page

This is described in more detail on this Wikipedia page but the syntax is as follows:

[[Image:Example2.png|150px |link=http://www.example.org |alt=Alt text|Title text]]


See also

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
Edit this template