模板:Multiple image/doc

维基百科,自由的百科全书
跳转到导航 跳转到搜索

本模板可生成一个垂直或水平排列多张图片的框,可以水平或者垂直组合,并给整个框或者单独的图片添加说明文字。

适当选择参数可以让模板自动将图像大小调整为给定的总宽度,每个图像具有相同的高度。

语法和参数[编辑]

提供height[n]total_width参数用于自动调整尺寸。

自动将所有图像调整为相同的高度和给定的总宽度
{{Multiple image|total_width = 600
<!-- 布局参数 -->
| align             = <!-- right(默认)、left、center、none --> 
| direction         = <!-- horizontal(默认)、vertical -->
| background color  = <!-- 框的背景颜色,web颜色,例如#33CC00 -->
| width             = <!-- 每个图像宽度显示的像素数(整数,省略“px”后缀);会被下面的“width[n]”覆盖 -->
| caption_align     = <!-- left(默认)、center、right --> 
| image_style       = <!-- border:1;(默认) -->
| image_gap         = <!-- 5(默认)-->

<!-- 顶部 -->
| header_background = <!-- 顶部的背景颜色,web颜色形式,如#33CC00 -->
| header_align      = <!-- center(默认)、left、right -->
| header            = <!-- 顶部文本 -->

<!--图像1-->
| image1            = <!-- 仅文件名称,不含“File:”或“Image:”前缀 -->
| width1            = <!-- 图像的显示宽度,会忽略上面的“width” -->
| alt1              = 
| link1             = 
| thumbtime1        =
| caption1          = 
<!--图像2-->
| image2            = <!-- 仅文件名称,不含“File:”或“Image:”前缀 -->
| width2            = <!-- 图像的显示宽度,会忽略上面的“width” -->
| alt2              = 
| link2             = 
| thumbtime2        =
| caption2          = 
<!-- 依此类推,最多10个(image10) -->

<!-- 底部 -->
| footer_background = <!-- 底部的背景,web颜色形式,如#33CC00 -->
| footer_align      = <!-- left(默认)、center、right -->
| footer            = <!-- 底部的文本 -->
}}
没有将所有图像自动调整为相同高度的大小
{{multiple image
<!-- 布局参数 -->
 | align             = <!-- right(默认)、left、center、none --> 
 | direction         = <!-- horizontal(默认)、vertical -->
 | background color  = <!-- box background -->
 | total_width       = <!-- 所有图片的总宽度的像素数(整数,忽略“px”后缀) -->
 | caption_align     = <!-- left(默认)、center、right --> 

<!-- 顶部 -->
 | header_background = 
 | header_align      = <!-- center(默认)、left、right -->
 | header            = 

<!--图像1-->
 | image1            = <!-- 仅文件名称,不含“File:”或“Image:”前缀 -->
 | alt1              = 
 | link1             = 
 | thumbtime1        =
 | caption1          = 
<!--图像2-->
 | image2            = <!-- 仅文件名称,不含“File:”或“Image:”前缀 -->
 | alt2              = 
 | link2             = 
 | thumbtime2        =
 | caption2          = 
<!-- 依此类推,最多10个(image10) -->

<!-- 底部 -->
 | footer_background = 
 | footer_align      = <!-- left(默认)、center、right -->
 | footer            = 
}}
参数 描述
align right (默认)、left、center
direction horizontal (默认)、vertical
background color 设置包含了各图像的框的背景颜色。
header_background
header_align center (默认)、left、right
header
width 用于给每个图像(覆盖下面的width[n])设置相同的宽度。如果想要不同的图像宽度,包括如果要将图像大小调整为固定的总宽度,则不要使用此参数。
total_width 用于将图像调整为相同的高度,总宽度为这个值。不要同时使用total_widthwidth
image[n] [n] = 1到10)  第n个图像的文件名称。
width[n] (同上)  两个含义:(1) 第n个图像的宽度(像素数,省略“px”)。会被width覆盖(如果设置了)。(2) 如果提供了total_width参数以将所有图像的大小调整为相同的宽度的指定的高度,则此值为原先的第n个图像的总宽度。
height[n] (同上)  如果提供了total_width以将所有图像的大小调整为相同的高度和指定的宽度,则此值为第n个图像的完整高度。其他情况下会忽略。
alt[n] (同上)  第n个图像的替代文本
link[n] (同上)  第n个图像链接至的页面。
  • 如果完全忽略了这个参数,那么图像和往常一样,链接至图像的描述页。
  • 如果此参数存在但是留空,图像不会有链接,根据WP:ALT,这通常用于图像仅用途装饰的情况。
thumbtime[n] (同上)  使用视频文件时,设置最初显示的时间位置。
caption[n] (同上)  第n个图像的描述文本。
caption_align left (默认)、center、right
footer_background
footer_align left (默认)、center、right
footer 包含整个框宽度范围的描述文本,区别与单独的图像。如有可能,请避免“left”和“right”,因此铥设备可能会将图片垂直显示。

示例[编辑]

黄牌用于警告,红牌用于罚下。
{{multiple image
 | width = 60
 | image1 = Yellow card.svg
 | alt1 = 黄色椭圆形边缘
 | image2 = Red card.svg
 | alt2 = 红色椭圆形边缘
 | footer = 黄牌用于警告,红牌用于罚下。
}}
PNG 透明度示范
具有8位透明度图层的PNG图像...
...这里覆盖一个方格的背景。
{{multiple image
 | align = left
 | direction = vertical
 | width = 200
 | header = [[Portable Network Graphics|PNG]] 透明度示范
 | image1 = PNG transparency demonstration 1.png
 | alt1 = 彩色骰子加白色背景
 | caption1 = 具有8位透明度图层的PNG图像...
 | image2 = PNG transparency demonstration 2.png
 | alt2 = 彩色骰子加方格背景
 | caption2 = ...这里覆盖一个方格的背景。
}}

使用background color[编辑]

{{multiple image
 | background color = #BBDD99
 | width = 160
 | image1 = Adoxa_moschatellina_210406.jpg
 | alt1 = 綠草與一些小黃白色的花
 | image2 = Adoxa_moschatellina_210406a.jpg
 | alt2 = 在綠色葉子背景前的三朵小白色和黃色的花
 | image3 = adoxa_moschatellina_blatt.jpeg
 | alt3 = 一棵植物的葉,每組有三個,每個有三塊葉
 | footer_background = #BBDD99
 | footer_align = center
 | footer = Adoxa([[五福花]])
}}

使用链接 (link[n])[编辑]

A mule
(骡子 luózi
A donkey
(驴子 lǘzi
A fish
( )
骡子的图像链接至骡子,驴子的图像则没有链接,鲑鱼的图像链接至图像的描述页面。
{{multiple image
 | align = left

 | image1 = Frecklesmule.jpg
 | width1 = 143
 | alt1 = A mule
 | link1 = 骡子
 | caption1 = A mule<br />(骡子 ''luózi'')

 | image2 = Donkey 1 arp 750px.jpg
 | width2 = 150
 | alt2 = 驴子
 | link2 = 
 | caption2  = A donkey<br />(驴子 ''lǘzi'')

 | image3 = Rainbow_trout.png
 | width3 = 91
 | alt3 = 鲑鱼
 | caption3  = A fish<br />({{lang|zh|2=鱼}} '''')

 | footer = 骡子的图像链接至[[骡子]],驴子的图像则没有链接,鲑鱼的图像链接至图像的描述页面。
}}

多行[编辑]

要创建一系列的图像并带有多行,使用|perrow=,其值可以是一个单独的数字,或者是由/分隔的一组数字。此功能可以和|total_width=组合使用,用于多行图片相同的总宽度。

测量设备。从左上角顺时针:光学经纬仪、机器人全站仪、光学水准仪、实时运动学GPS基站。
{{multiple image|perrow = 2|total_width=300
| image1 = Kern_Theodolit_DKM2-A.jpg  |width1=319|height1=425
| image2 = Total-Robotic-Station.jpg  |width2=1728|height2=3072
| image3 = DumpyLevel.jpg  |width3=1600|height3=1200
| image4 = GPS_Survey_Equipment_at_Weir_Dyke_Bridge_-_geograph.org.uk_-_336908.jpg|width4=427|height4=640
| footer = 测量设备。从左上角顺时针:光学经纬仪、机器人全站仪、光学水准仪、实时运动学GPS基站。
}}

模板数据[编辑]

以下是该模板的模板数据,适用于可视化编辑器等工具。

Multiple image模板数据

<templatedata> { "description": "创建一个带有两个或者多个水平或者竖直排行的图像的框,并带有整个框或者单独的每个图像的描述文本。", "format": "block", "params": { "align": { "type": "string", "label": "对齐", "default": "right", "description": "设置图像框周围的文本环绕,其中“none”将框放置在不带文本环绕的左边缘,“center”将框放在不带文字环绕的中心,“left”和“right”指的是带文本环绕框在屏幕上的位置。", "example": "left/right/center/none", "suggestedvalues": [ "left", "center", "right", "none" ] }, "direction": { "default": "horizontal", "type": "string", "label": "方向", "description": "平铺图像的方向。", "example": "horizontal/vertical", "suggested": true, "suggestedvalues": [ "horizontal", "vertical" ] }, "total_width": { "type": "number", "label": "框宽度", "description": "用于将图像缩放到相同的高度和总宽度。不要同时使用total_width和width。以像素为单位的整数宽度;没有“px”后缀", "example": "400", "suggested": true }, "perrow": { "type": "string", "label": "行布局", "description": "创建有多行的一系列图像。值可以是单个数字,也可以是每行由“/”分隔的一组数字。可以与total_width组合使用以自动调整图像大小。", "example": "1 / 2 / 1" }, "width": { "type": "number", "label": "图像宽度", "description": "会覆盖width1、width2、width3等,如果你需要为图像设置不同的宽度,不要使用此参数。整数,单位为像素,但不带“px”后缀。", "example": "200" }, "background color": { "type": "string", "label": "背景颜色", "description": "定义框的边框和图像之间的背景色。更改背景可能影响无障碍访问,请尽可能避免。", "example": "#EEFFGG或red" }, "caption_align": { "default": "left", "type": "string", "label": "描述文本的对齐", "example": "left/right/center", "suggestedvalues": [ "left", "center", "right" ] }, "image1": { "description": "第1个图像的名称。仅文件名称,不带“File:”或“Image:”前缀。", "type": "wiki-file-name", "example": "example.jpg", "suggested": true, "required": true, "label": "图像1" }, "width1": { "description": "第1个图像的宽度。", "type": "number", "label": "宽度1" }, "alt1": { "type": "line", "description": "第1个图像的替代文本。", "label": "替代文本", "suggested": true }, "caption1": { "type": "content", "description": "第1个图像的描述文本。", "suggested": true, "label": "描述1" }, "link1": { "type": "wiki-page-name", "description": "第1个图像链接至的页面。如果没有指定,则图像链接至描述页面。如果指定为空值,则没有链接,根据WP:ALT,当图像仅用途装饰时适用于这种情况。", "label": "链接1" }, "thumbtime1": { "type": "string", "description": "如果第1个图像是Ogg Theroa文件,设置初始位置的时间。秒数,或者是“时:分:秒”形式。", "label": "帧时间1" }, "image2": { "example": "example.jpg", "suggested": true, "label": "图像2", "type": "wiki-file-name" }, "width2": { "type": "number", "label": "宽度2" }, "alt2": { "label": "替代文本2", "type": "line", "suggested": true }, "caption2": { "type": "content", "suggested": true, "label": "描述2" }, "link2": { "type": "wiki-page-name", "label": "链接2" }, "thumbtime2": { "type": "string", "label": "帧时间2" }, "image3": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像3" }, "width3": { "type": "number", "label": "宽度3" }, "alt3": { "type": "line", "label": "替代文本3" }, "caption3": { "label": "描述3", "type": "content" }, "link3": { "label": "链接3", "type": "wiki-page-name" }, "thumbtime3": { "type": "string", "label": "帧时间3" }, "image4": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像4" }, "width4": { "type": "number", "label": "宽度4" }, "alt4": { "type": "line", "label": "替代文本4" }, "caption4": { "label": "描述4", "type": "content" }, "link4": { "label": "链接4", "type": "wiki-page-name" }, "thumbtime4": { "type": "string", "label": "帧时间4" }, "image5": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像5" }, "width5": { "type": "number", "label": "宽度5" }, "alt5": { "type": "line", "label": "替代文本5" }, "caption5": { "label": "描述5", "type": "content" }, "link5": { "label": "链接5", "type": "wiki-page-name" }, "thumbtime5": { "type": "string", "label": "帧时间5" }, "image6": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像6" }, "width6": { "type": "number", "label": "宽度6" }, "alt6": { "type": "line", "label": "替代文本6" }, "caption6": { "label": "描述6", "type": "content" }, "link6": { "label": "链接6", "type": "wiki-page-name" }, "thumbtime6": { "type": "string", "label": "帧时间6" }, "image7": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像7" }, "width7": { "type": "number", "label": "宽度7" }, "alt7": { "type": "line", "label": "替代文本7" }, "caption7": { "label": "描述7", "type": "content" }, "link7": { "label": "链接7", "type": "wiki-page-name" }, "thumbtime7": { "type": "string", "label": "帧时间7" }, "image8": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像8" }, "width8": { "type": "number", "label": "宽度8" }, "alt8": { "type": "line", "label": "替代文本8" }, "caption8": { "label": "描述8", "type": "content" }, "link8": { "label": "链接8", "type": "wiki-page-name" }, "thumbtime8": { "type": "string", "label": "帧时间8" }, "image9": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像9" }, "width9": { "type": "number", "label": "宽度9" }, "alt9": { "type": "line", "label": "替代文本9" }, "caption9": { "label": "描述9", "type": "content" }, "link9": { "label": "链接9", "type": "wiki-page-name" }, "thumbtime9": { "type": "string", "label": "帧时间9" }, "image10": { "type": "wiki-file-name", "example": "example.jpg", "label": "图像10" }, "width10": { "type": "number", "label": "宽度10" }, "alt10": { "type": "line", "label": "替代文本10" }, "caption10": { "label": "描述10", "type": "content" }, "link10": { "label": "链接10", "type": "wiki-page-name" }, "thumbtime10": { "type": "string", "label": "帧时间10" }, "image_gap": { "type": "number", "label": "图像间隔", "description": "设置相邻的图像之间的间隔。整数,单位为像素,没有“px”后缀。", "example": "20", "default": "5" }, "image_style": { "type": "string", "label": "图像样式", "description": "覆盖图像框的默认样式。" }, "header": { "type": "content", "label": "顶部", "description": "整个框上方的顶部文本。" }, "header_background": { "type": "string", "label": "顶部背景", "description": "定义顶部文本的背景颜色。改变背景可能会影响无障碍访问,请尽可能避免。", "example": "#EEFFGG或red" }, "header_align": { "default": "center", "type": "string", "label": "顶部对齐", "example": "left/right/center" }, "footer": { "type": "content", "label": "底部", "description": "整个框范围的描述文本,不同于独立的图像。如有可能,避免left和right,因为移动设备可能会像图像垂直显示。" }, "footer_background": { "type": "string", "label": "底部背景", "description": "定义底部文本的背景颜色。改变背景可能会影响无障碍访问,请尽可能避免。", "example": "#EEFFGG或red" }, "footer_align": { "default": "left", "type": "string", "label": "底部对齐", "example": "left/right/center", "suggestedvalues": [ "left", "center", "right" ] }, "border": { "label": "显示或隐藏框", "description": "使用值“infobox”以在信息框内使用时将边框隐藏。", "suggestedvalues": [ "infobox" ] } } }</templatedata>

参见[编辑]