From Qi-Hardware
Jump to: navigation, search

Template:H:h 要在文件中加入的圖片,必須事先予以上載。其他類型的檔案也可以上載,如下述,在本系統中任何被上載的檔案都統稱為『圖片(image)』。如果將上載的圖片儲存於 Wikimedia Commons 則可以使之置放在任何 Wikimedia 專案內,這與一般檔案只能出現在這個檔案被上載所在的專案的方式有所不同 。

首先為圖片檔案取個適當的名字,因為上載後這個檔案就無法被更名。請記得檔案名字中要納入合宜的延伸檔名。上載時,可以另取不同的名字儲存在目標位置。另伴隨圖片頁次(也稱為『圖片說明頁』) ,及由圖片的名字(含延伸檔名)所構成的圖片名字,冠以"Image:"(或通常是 {{ns:Image}} 變數的值)。因此圖片名字的大小寫是有區分的(延伸檔名也是如此)。對大多數的專案,第一個字母則不受此限制。

雖然每一個專案都可以自行上載所需用的檔案,但對同一族群的專案,你可以指定其中一個專案專司此事,而允許其內的檔案被同族群的其他專案分享。對 Wikimedia 專案而言,這個專案指的是Wikicommons(僅限免費內容,無『公平使用(fair use)』內容),以下我們都一律簡稱 Commons。(請注意專案的同族群的意義僅只於此,至於各專案的登入與喜好設定則不互屬,這個定義適用於 Wikimedia 專案,反之,this applies for Wikicities.))

要上載一個檔案,前往 Commons,由此登入,然後透過上載鏈結(uplaod link)來上載檔案。


[edit] 檔案名稱


(以下「圖」與「檔」同義;惟某些細微複雜處,如重名阻礙(duplicate names blocking access),則為插圖所獨有。)

當你在維基共享替換或刪圖,其影響遍及各維基媒體計劃。 所以必須連結維基共享上之圖象頁至各維基子計劃內之相同圖象檔。縱使這些圖檔未被「正式製造」(created explicitly)而無可編輯之內容, "image links" 一節仍顯示各子計劃內有用此圖之頁。




  • 此圖不能用於其他計劃;
  • 在該計劃上無法用上現有或將有之同名檔。

故此應只在特殊情況下 在計劃上局部地上載圖--例如:以局部版本取代維基同享上之圖 ,而不必改連結。

[edit] 連結

請用[[Media:So.gif]] 而非[[Image:So.gif]]以連結一圖: Media:So.gif;若要連結至圖之解釋頁,請用 [[:Image:So.gif]],如 Image:So.gif (首冒號不會顯示)。



誇維基連結 之格式將連結至該圖之描述頁。若要插入連結至圖檔本身(若可能時),請用外連結格式。

如果多语言维基内部链接可行,您可在语言编码前后各加一个冒号(例:英语的编码为“en”)。[[:de:Bild:Europa-Pos.png]], 以避免理解被放置边缘.

外部链接语句写法与平时编辑时一致。然而,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.


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.

[edit] 插入內部圖案

此「內部」指計劃內或維基共享上。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.

[[image:tst.png|abc]] gives abc

[[image:tst.png|50px|abc]] gives abc

The form [[image:tst.png|50px|thumb|abc]] does not allow enlargement, it gives (see on the right):

Template:- To add the uploaded image to an article as a thumbnail, one can use [[Image: image name including extension |thumb|caption]] or [[Image: image name including extension |thumb|width in pixels px|caption]].

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. [[image:tst.png|thumb|50px|[[Media:tst.png|actual size]]]]Template:-

File:Middle east.jpg
Middle East; for more detailed pdf-version see [1]

欲知更多選擇,見en:Wikipedia:Extended image syntax. Also, the source of existing pages with images are useful as examples.

[edit] 圖像在左

[[image:tst.png|left|thumb|50px|[[help:contents|demo]]]] 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 [[image:tst.png|none|thumb|50px|[[help:contents|demo]]]] 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

[edit] 左圖

[[image:tst.png|right|thumb|50px|[[help:contents|demo]]]] 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.

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. after the 1st image. after the 2nd image.

[edit] Using full width again

Use <br clear="all" />, or on projects that have Template:Clr (Meta and en:): {{clr}}. Text floats around the image until it gets to {{clr}} (in Meta) like this.

After {{clr}}, 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.

[edit] 字裏行間圖

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 but they can not be enlarged.

Example (note the hoverbox too): "text [[image:Wikipedia minilogo.gif]] text [[image:Wikipedia minilogo.gif|5px|]] text [[image:Wikipedia minilogo.gif|100px|demo]] text" gives "text File:Wikipedia minilogo.gif text File:Wikipedia minilogo.gif text demo text".

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

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

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

  • external, with label: [ train]


  • external, footnote style: []


[edit] Gallery tag, category, table of images

The gallery-tag is a quick way to show thumbnails in four columns. Each entry is of the form "Image:image name or "Image:image name|caption, possibly with links". It also allows text taking the position of an image, but not with links: if a text entry contains a link, the whole entry is ignored; an image tag with square brackets is also ignored. It is possible to give a title to the gallery with the caption parameter.

<gallery caption="Sample gallery">
Image:Drenthe-Position.png|[[w:Drenthe|Drenthe]], the least crowded province
[[Friesland]] is beautiful
Image:Zuid_Holland-Position.png|[[w:South Holland|South Holland]], the most crowded province


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

Depending on the browser, a long caption may or may not widen a whole column of images:

  • even if it does, if necessary to fit the four columns on the screen, captions wrap automatically
  • alternatively, a long caption makes the whole row taller, because too long captions wrap to produce multiple lines in their container. See also w:Wikipedia:Gallery.

A gallery of images in a category is automatically shown as the fourth section of the 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. No alternative text or other links are possible. Also the file size is shown.

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

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 automatically gives file sizes.

Example of an image table:

|+'''Provinces of the Netherlands'''
| valign="top"|
[[Image:Drenthe-Position.png|thumb|left|150px|[[w:Drenthe|]], the least crowded province]]
| valign="top"|
| valign="top"|
| valign="top"|
| valign="top"|
[[Image:Zuid_Holland-Position.png|thumb|left|100px|[[w:South Holland|]], the most crowded province]]
| valign="top"|


Provinces of the Netherlands
Drenthe, the least crowded province

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.

[edit] 導航地圖

Navigational maps like [3] have map areas linked to pages. The html with <area> tags can not be put in the wikitext. However, there are the following possibilities:

  • EasyTimeline allows the creation of an image and a page embedding that image, with rectangular map areas defined by <area> tags in the html. The title of a link to a non-internal page is only the domain name, e.g. "". 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:

[edit] EasyTimeline 例

例 1

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


例 2

Preset     = TimeHorizontal_AutoPlaceBars_UnitYear
ImageSize = width:500 barincrement:50
Period     = from:0 till:12
Define $s = fontsize:XL
BackgroundColors = canvas:white
  bar:a from:3 till:4 $s text:[|Leiden]
  bar:a  from:6 till:7 $s text:[|Alphen aan den Rijn]
  bar:b  from:1 till:2 $s text:[|The Hague]
  bar:c  from:3 till:4 $s text:[|Rotterdam]


[edit] 其他方法

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


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

   xxx Leiden

xxxx The Hague

       xxxxx Rotterdam

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: Leiden The Hague Rotterdam

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

[edit] 上載

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

[edit] 容許之檔案類

Apart from text, MediaWiki supports the following media inline:

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 m:SVG image support.

There may be a size limit, the largest one on en: 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).


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

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.

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

Also you may find php and apache limit the filesize of uploads too 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: (It might be better to have this information conglomerated more centrally).

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

Apache has a directive "LimitRequestBody", which controls the maximum number of bytes allowed in ANY http request.

[edit] 模板:使用恰当的图标表示链接

要想使文档与其相应的图标一起被放在链接处,同时也有文档的维基页面链接, 参见这里.

这是针对任何支持嵌入外部图像技术的维基 - 也是建立在MediaWiki技术之上的最具个性化的,组织性与编制能力的功能。需注意的例外是维基百科和Meta。因为Meta无法编译此模板,以下为一例:图像将如何在样板上被显示:File:PDF file example.png

[edit] 圖象檔之修改史


[edit] 預設


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

[edit] 保護

Images on MediaWiki:Bad image list can not be embedded, they appear as regular link to the image page. See e.g. 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.

[edit] 插入外來圖片

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, e.g. on the Dutch Wikipedia.

If enabled in LocalSettings.php

$wgAllowExternalImages = true;



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.


If enabled, use unbracketed external link style, i.e. just the URL (of the image itself, not of the image description page), e.g. 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 b gives a 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 text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 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.






[edit] WikiTeX

WikiTeX ([5]) is a MediaWiki extension that can produce graphs of functions, various diagrams, etc. It is operational at , but not yet at Wikimedia projects. Note that one can anyway produce an image on Wikisophia, and subsequently upload it on any MediaWiki project.

[edit] 參閱

[edit] 外連結


Personal tools