Help:链接到文件

This page is a translated version of the page Help:Linking to files and the translation is 54% complete.
Outdated translations are marked like this.
PD 注意:當您編輯本頁面時,即同意以CC0協議授權您的貢獻。您可以在公有領域说明页面找到更多信息。
PD
关于linking from files to other pages,参见:Help:Images#Altering the default link target

首先学会

Before you can link to files, you first need to know the basics of:

Not the same as embedding

This help page is about linking to files. Don't confuse that with embedding an image file in a page. Although they're both ways of using files, they're not the same.

Embedding an image file for example, might be having a person's picture appear alongside the text on a page about that person. 关于如何嵌入图像,参见帮助:图像

为什么链接?

In some situations, you don't want the file to be embedded in another page. 你想在页面上创建一个到某特定文件的描述页面的链接。 或者你可能想链接到文件本身。 这儿有一些你可能不想将文件嵌入而只想创建链接的例子:

  • 文件不是可嵌入页面的类型(比如,一张电子表格——假设维基允许上传这种类型的文件)。
  • 文件是图像,但是太大以至于只在他本身的页面管用(比如细节地图)。
  • 你想指导读者哪里能下载或替换文件。

链接到文件描述页面

你可以创建一个到文件描述页面的链接,只需在File:前面加上半角冒号:):

File:Example.jpg

[[:File:Example.jpg]]

Sunflowers

[[:File:Example.jpg|Sunflowers]]

注意如果你忘记开头的冒号的话,你将嵌入图片

链接到文件本身

使用伪名字空间Media将链接到文件本身。 链接将不会将你带到文件描述页面,而是直接到文件本身。

Media:Example.jpg

[[Media:Example.jpg]]

Sunflowers

[[Media:Example.jpg|Sunflowers]]

(如果依照上述操作将你链接到文件描述页面,而不是文件本身,可能该维基名字空间设定与本功能有出入?)

Direct links from external sites

Another possibility is to use the Special:Redirect/file page (or its alias Special:Filepath). Unlike the above example, you can link to it from external websites as well as from MediaWiki pages.

[[Special:Redirect/file/Wikipedia.png]]

The parameters height and width can also be added to return a specific size of the image. The image aspect ratio is always preserved.

https://www.mediawiki.org/w/index.php?title=Special:Redirect/file/Wikipedia.png&width=100&height=100