Help:扩充图像语法
维基百科,自由的百科全书
目录 |
[编辑] 使图像按上传时的大小显示,并带有标题
要使图像按照上传时的大小显示,可用[[Image:Westminstpalace.jpg|frame|none|标题文字]]
。 应使用这种语法代替原来的这种图像标记形式[[Image:Westminsterpalace.jpg|标题文字]]
。
[编辑] 不需要自动设置标题和格式的图像语法
旧的无标题图像的语法是[[Image:Westminstpalace.jpg|替代文字]]。这是在线渲染的,且所指定的文本用作图像的alt属性(当程序无法显示图像时用作替代文字,例如屏幕阅读器)和title属性(附加的文字,通常当鼠标停留在图像上时作为一个工具提示显示)。
为图像设置标题有一种使用HTML代码的老方法,在Wikipedia:HTML图像标记里面有介绍,这种方法已经过时了。请使用本文介绍的新方法来组合图像和标题。
Wikipedia:标题这篇文章讨论如何选择合适的标题文字。Wikipedia:图像的替代文字这篇文章则讨论选择合适的替代文字。不幸的是,没有办法为了这两个目的分别指定不同的文字。
[编辑] 示例
[编辑] 新的图像语法
新的语法是向后兼容的,因此不需要更改文章内容。在这种语法[[Image:文件名|选项]] (例如 [[Image:Westminstpalace.jpg|thumb|100px|left|西敏宫]] 显示效果见左)中,图像可以包含多个选项。这些选项会对图像的位置、大小及显示方式造成影响。选项包括right, left, center, none, sizepx, thumbnail (thumb), frame和alternate (caption) text。
这些选项可以组合起来,用竖线(“|”)分隔开来,顺序随意。未知的选项就被当作标题文本。如果有两个以上未知的选项,最后一个有效: [[Image:Westminstpalace.jpg|thumb|西敏宫|200px|right|拍摄于泰晤士河]] (见右)。
除了标题文字外,其它的选项有:
- right
-
这个图像是右对齐的,文字则浮在图像的左边:[[Image:Westminstpalace.jpg|right|70px|]](见右)。
- left
-
这个图像是左对齐的,文字则浮在图像的右边:[[Image:Westminstpalace.jpg|left|70px|]](见左)。
- center
- 该图像居中放置,且……
文字紧随着在它之后:[[Image:Westminstpalace.jpg|center|70px|]](见上)。
- none
- 该图像放在左边,且……
随后的文字并不浮在右侧(更不会在左侧),而是在其下方开始:[[Image:Westminstpalace.jpg|none|70px|]](见上)。
-
- 注意:
-
以上四个选项互不兼容。当组合起来使用时,只有最后一个选项有效:[[Image:Westminstpalace.jpg|none|right|center|left|70px|]] (见左)。
-
-
不管最后一条竖线和最后两个方括号(“]]”)中间有没有东西,是什么东西,都算做最后一个选项,和其它的选项一样处理。例如,当最后一个选项是right时,图像是右对齐的,而且文本浮在左边:[[Image:Westminstpalace.jpg|70px|right]](见右)。
-
不管最后一条竖线和最后两个方括号(“]]”)中间有没有东西,是什么东西,都算做最后一个选项,和其它的选项一样处理。例如,当最后一个选项是right时,图像是右对齐的,而且文本浮在左边:[[Image:Westminstpalace.jpg|70px|right]](见右)。
-
-
一般而言,如果最后一个选项没有文字(换句话说,最后一条竖线和最后两个方括号之间什么也没有),标题就不会显示:如[[Image:Westminstpalace.jpg|thumb|此文本不会显示。|70px|left|]](见左)和[[Image:Westminstpalace.jpg|thumb|此文本会显示。|70px|right]] (shown on the right)(见右)。
-
一般而言,如果最后一个选项没有文字(换句话说,最后一条竖线和最后两个方括号之间什么也没有),标题就不会显示:如[[Image:Westminstpalace.jpg|thumb|此文本不会显示。|70px|left|]](见左)和[[Image:Westminstpalace.jpg|thumb|此文本会显示。|70px|right]] (shown on the right)(见右)。
- sizepx
-
This option renders a version of the image that's [size] pixels wide (e.g. [[Image:Westminstpalace.jpg|right|50px|]] shown on the right). Height is computed to keep (i.e. the shape of the image)
- Note that this does not just change the apparent image size using HTML; it actually generates a resized version of the image on the fly and links to it appropriately. This happens whether or not you use size in conjunction with thumb.
-
- Note:
When there are two or more "size" options, only the last one is valid: [[Image:Westminstpalace.jpg|right|50px|80px]] (shown on the right).
- Note:
When there are two or more "size" options, only the last one is valid: [[Image:Westminstpalace.jpg|right|50px|80px]] (shown on the right).
- thumbnail, thumb
-
The thumbnail (thumb) option generates a image. It is automatically resized when the "size" attribute is not specified. Without the options left, center, and none, the image is normally on the right. If the image has a caption text, it is displayed in the lower margin. E.g. [[Image:Westminstpalace.jpg|thumbnail|left|100px|]] (shown on the left) and [[Image:Westminstpalace.jpg|thumb|The Palace of Westminster]] (shown on the right).

An "enlarge"-icon is put also in the lower margin of the thumbnail. Both the image itself and the icon link to the image description page with the image in its actual size. The icon shows the link title "Enlarge" in its hoverbox, even in cases where this term does not apply, because it leads from the enlarged image to the one with the actual size. E.g. [[Image:tst.png|right|thumb|100px|This is a globe, and take a look at it in [[Media:tst.png|the actual size]].]] (shown on the right).
- frame
-
With this option, the embedded image is shown with its actual size enclosed by a frame, regardless of the "thumb" or "size" attribute, and the caption, if any, is visible in the frame. Without the options left, center, and none, the image is normally on the right: [[Image:Westminstpalace.jpg|frame|thumbnail|50px|The Palace of Westminster]].
With none of the options other than sizepx and alternate (caption) text, an embedded image is rendered inline. Note that the size of the inline images can be reduced but they can not be enlarged.
text text text text text text [[Image:Westminstpalace.jpg|150px|The Palace of Westminster]] text text text text text [[Image:tst.png|100px|This is a globe.]] text text text text
gives
text text text text text text text text text text text
text text text text
The option none can be used to have thumbnails without left- or right-alignment. This is probably most useful for tables. This is an example:
How to use none | ||
---|---|---|
London's palaces | ||
Palace of Westminster | [[Image:Westminstpalace.jpg|thumb|none|100px|From the Thames]] | |
Buckingham Palace |
Image:Buckingham palace Copyright2003KaihsuTai.jpg
Queen's home
|
[[Image:Buckingham palace Copyright2003KaihsuTai.jpg|thumb|none|100px|Queen's home]] |
[编辑] Thumbnail with caption text underneath that has one or more links
From MediaWiki 1.3, it is also possible to include links in the caption text, e.g.:
[[Image:Westminstpalace.jpg|right|thumbnail|This is the [[Palace of Westminster]] in London]]
Just make sure the number of opening and closing square brackets are right. One extra/missing would mean the entire image syntax line not working.
[编辑] Cancelling floating-around-image mode
After having had an image floating next to text, putting further text below it and again using the full width can be done with the following markup. This blocks an image from appearing next to the material following this markup, possibly due to aesthetic reasons or a change in topics.
- <br style="clear:both" />
[编辑] Linking to the image description page
If you want to make a link to the description page for an image, use a leading colon before "image:" in an intra-wiki link, like this: [[:image:STS-32 crew.jpg|STS-32 crew]] which yields: STS-32 crew
[编辑] Image galleries
See
- Wikipedia:Gallery.
[编辑] 參看
- 維基共享資源 (Commons Main Page), a free multimedia repository, that you can use directly in Wikipedia and the other Wikimedia projects. You can upload new images or use the stored ones.
- Wikipedia:Gallery for new syntax to display multiple images
- Image use policy
- Image markup with HTML (this page is deprecated)
- Picture tutorial
- Finding images tutorial
- meta:Help:Images and other uploaded files