Bản mẫu:Nhiều hình

Bách khoa toàn thư mở Wikipedia
(Đổi hướng từ Bản mẫu:Multiple image)
Tài liệu bản mẫu[xem] [sửa] [lịch sử] [làm mới]


This template creates a box with two to ten images arranged vertically or horizontally with captions for the entire box or for each image.

With the appropriate choice of parameters, the template can automatically resize images to a given total width with each image having the same height.

Be aware that this template does not respect users' default image size preferences. (Wikipedia:Image use policy states: "Except with very good reason, do not use px"... "which forces a fixed image width. In most cases upright=scaling factor should be used, thereby respecting the user's base preference (which may have been selected for that user's particular devices).")

If image size parameters are omitted, this template sets all images at 200px wide, regardless of whether the reader has set a preference for some other default image width. This causes multiple images to look out of scale to the other images in an article.

Cú pháp và các thông số[sửa mã nguồn]

Không có tự động thay đổi kích thước của tất cả các hình ảnh để cùng một chiều cao
{{nhiều hình
<!-- Layout parameters -->
 | align             = <!-- right (default), left, center, none --> 
 | direction         = <!-- horizontal (default), vertical -->
 | background color  = <!-- box background -->
 | width             = <!-- displayed width of each image in pixels (an integer, omit "px" suffix); overrides "width[n]"s below -->
 | caption_align     = <!-- left (default), center, right --> 

<!-- Header -->
 | header_background = 
 | header_align      = <!-- center (default), left, right -->
 | header            = 

<!--image 1-->
 | image1            = <!-- filename only, i.e. without "Tập tin:" or "Hình:" prefix -->
 | width1            = <!-- displayed width of image; overridden by "width" above -->
 | alt1              = 
 | link1             = 
 | caption1          = 
<!--image 2-->
 | image2            = <!-- filename only, i.e. without "Tập tin:" or "Hình:" prefix -->
 | width2            = <!-- displayed width of image; overridden by "width" above -->
 | alt2              = 
 | link2             = 
 | caption2          = 
<!-- and so on, to a maximum of 10 images (image10) -->

<!-- Footer -->
 | footer_background = 
 | footer_align      = <!-- left (default), center, right -->
 | footer            = 
}}
Tự động thay đổi kích thước của tất cả các hình ảnh để cùng một chiều cao và tổng chiều rộng cho
{{nhiều hình
<!-- Layout -->
 | align             = <!-- right (default), left, center, none --> 
 | direction         = <!-- horizontal (default), vertical -->
 | background color  = <!-- box background -->
 | total_width       = <!-- total width of all the displayed images in pixels (an integer, omit "px" suffix) -->
 | caption_align     = <!-- left (default), center, right --> 

<!-- Header -->
 | header_background = 
 | header_align      = <!-- center (default), left, right -->
 | header            = 

<!--image 1-->
 | image1            = <!-- filename only, i.e. without "Tập tin:" or "Hình:" prefix -->
 | width1            = <!-- full width of the ORIGINAL UNSCALED image -->
 | height1           = <!-- full height of the ORIGINAL UNSCALED image -->
 | alt1              = 
 | link1             = 
 | caption1          = 
<!--image 2-->
 | image2            = <!-- filename only, i.e. without "Tập tin:" or "Hình:" prefix -->
 | width2            = <!-- full width of the ORIGINAL UNSCALED image -->
 | height2           = <!-- full height of the ORIGINAL UNSCALED image -->
 | alt2              = 
 | link2             = 
 | caption2          = 
<!-- and so on, to a maximum of 10 images (image10) -->

<!-- Footer -->
 | footer_background = 
 | footer_align      = <!-- left (default), center, right -->
 | footer            = 
}}
Tham số Miêu tả
align right (default), left, center
direction horizontal (default), vertical
background color To set the background color of the box in which the images appear.
header_background
header_align center (default), left, right
header
width Use to set the same width for each image (i.e. overrides any width[n] below). Do not include if different image widths intended, including if images are to be resized to a fixed total width.
total_width Use to scale the images to the same height and this total width. Do not use both total_width and width.
image[n] (where [n] = 1 to 10)  Filename of [n]th image.
width[n] (as above)  Two meanings: (1) The width (in pixels, integer, omit "px") of [n]th image. Overridden by width (if set). (2) The full width of the original [n]th image if total_width is given in order to resize all images to the same height and a given total width.
height[n] (as above)  The full height of the original [n]th image if total_width is given in order to resize all images to the same height and a given total width. Ignored otherwise.
alt[n] (as above)  Alt description for [n]th image.
link[n] (as above)  To specify the page to which the [n]th image is linked (i.e. the page that is loaded when the image is clicked). If set as empty (e.g. ...|alt1=... |link1= |caption1=...), linking is disabled (even to the standard Wikipedia image description page); consider WP:ALT.
Note: This parameter must not be used with images that have been given free licenses (such as the GDFL or a free CC license) as these licenses require images to be linked to a declaration of the license under which they are being used.
caption[n] (as above)  Caption for the [n]th image.
caption_align left (default), center, right
footer_background
footer_align left (default), center, right
footer Caption that spans the entire box, as opposed to individual images.

Các ví dụ[sửa mã nguồn]

Hình ô van màu vàng
Hình ô van màu đỏ
Các cầu thủ chơi được khuyến cáo với một thẻ vàng và bị đuổi khỏi sân với một thẻ đỏ.
{{nhiều hình
 | width = 60
 | image1 = Yellow card.svg
 | alt1 = Hình ô van màu vàng
 | image2 = Red card.svg
 | alt2 = Hình ô van màu đỏ
 | footer = Các cầu thủ đang chơi bị cảnh cáo với một thẻ vàng và bị đuổi khỏi sân với một thẻ đỏ.
}}
Trưng bày trong suốt PNG
Xúc xắc màu với nền màu trắng
Một hình ảnh PNG với một lớp 8-bit trong suốt...
Xúc xắc màu với nền màu trong suốt
...Ở đây bao phủ một nền màu trong suốt.
{{nhiều hình
 | align = left
 | direction = vertical
 | width = 200
 | header = Trưng bày trong suốt [[Mạng di động đồ họa|PNG]]
 | image1 = PNG transparency demonstration 1.png
 | alt1 = Xúc xắc màu với nền màu trắng
 | caption1 = Một hình ảnh PNG với một lớp 8-bit trong suốt...
 | image2 = PNG transparency demonstration 2.png
 | alt2 = Xúc xắc màu với nền màu trong suốt
 | caption2 = ...Ở đây bao phủ một nền màu trong suốt.
}}
2
3
4
Khi một thành viên có rất nhiều loại của barnstar, họ có thể đại diện cho họ với ruy băng và các chữ số để cho biết số đếm.
{{nhiều hình
 | width = 60
 | image1=Ribbon numeral 2.png | alt1=2
 | image2=Ribbon numeral 3.png | alt2=3
 | image3=Ribbon numeral 4.png | alt3=4
 | footer = Khi một thành viên có rất nhiều loại của [[WP:BARN|barnstar]], họ có thể đại diện cho họ với [[WP:RIBBON|ruy băng]] và các chữ số để cho biết số đếm.
}}

Với màu nền (background color)[sửa mã nguồn]

Thảo mộc màu xanh lá cây với một vài bông hoa nhỏ xíu, màu vàng-trắng
Ba hoa nhỏ màu trắng và màu vàng trước khi nền màu xanh lá cây
Lá của một trồng cây, trong mỗi nhóm ba với ba thùy
Adoxa (Adoxa moschatellina)
{{nhiều hình
 | background color = #BBDD99
 | width = 160
 | image1 = Adoxa_moschatellina_210406.jpg
 | alt1 = Thảo mộc màu xanh lá cây với một vài bông hoa nhỏ xíu, màu vàng-trắng
 | image2 = Adoxa_moschatellina_210406a.jpg
 | alt2 = Ba hoa nhỏ màu trắng và màu vàng trước khi nền màu xanh lá cây
 | image3 = adoxa_moschatellina_blatt.jpeg
 | alt3 = Lá của một trồng cây, trong mỗi nhóm ba với ba thùy
 | footer_background = #BBDD99
 | footer_align = center
 | footer = [[Adoxa]] (''Adoxa moschatellina'')
}}

Với các liên kết (link[n])[sửa mã nguồn]

Một con la
Một con la
(骡子 luózi)
Một con lừa
Một con lừa
(驴子 lǘzi)
Một con cá hồi
Một con cá
( )
Hình ảnh con la liên kết đến Con la; hình ảnh con lừa không liên kết bất cứ nơi nào; hình ảnh cá hồi liên kết đến một trang miêu tả hình ảnh chuẩn.
{{nhiều hình
 | align = left

 | image1 = Frecklesmule.jpg
 | width1 = 143
 | alt1 = Một con la
 | link1 = Con la
 | caption1 = Một con la<br />(骡子 ''luózi'')

 | image2 = Donkey 1 arp 750px.jpg
 | width2 = 150
 | alt2 = Một con lừa
 | link2 = 
 | caption2  = Một con lừa<br />(驴子 ''lǘzi'')</center>

 | image3 = Rainbow_trout.png
 | width3 = 91
 | alt3 = Một con cá hồi
 | caption3  = Một con cá<br />({{lang|zh|2=鱼}} '''')</center>

 | footer = Hình ảnh con la liên kết đến [[Con la]]; hình ảnh con lừa không liên kết bất cứ nơi nào; hình ảnh cá hồi liên kết đến một [[Trang miêu tả hình ảnh|trang miêu tả hình ảnh chuẩn]].
}}

Sử dụng direction[sửa mã nguồn]

Theo mặc định, các hình ảnh được bản mẫu sắp xếp theo chiều ngang, thành hàng (xem bên trái; tương đương với thiết lập |direction=horizontal). Để trình bày chúng theo chiều dọc, nghĩa là thành cột, thiết lập |direction=vertical (xem bên phải).

(horizontal)
(vertical)

Để phù hợp với chiều cao hình ảnh[sửa mã nguồn]

  • Decide on a total width for all the images, say 320px
  • Examine the individual image pages to obtain the full resolution. For example:
  • Specify the full width and height for each image, of the form:
    • |width1= |height1= |width2= |height2=
  • Set the total width using |total_width=
Một con lừa
Hình ảnh hình chữ nhật của một con lừa, ban đầu được 536 điểm ảnh chiều cao.
Một con cá hồi
Hình ảnh hình vuông của một con cá hồi, ban đầu được 300 điểm ảnh chiều cao.
Cả hai hình ảnh đã được trả lại với cùng một chiều cao, và một tổng chiều rộng 320px
{{nhiều hình
 | align = right
 | total_width = 320

 | image1 = Donkey 1 arp 750px.jpg
 | width1 = 750 | height1 = 536
 | alt1 = Một con lừa
 | caption1 = Hình ảnh hình chữ nhật của một con lừa, ban đầu được 536 điểm ảnh chiều cao.

 | image2 = Rainbow_trout.png
 | width2 = 300 | height2 = 300
 | alt2 = Một con cá hồi
 | caption2 = Hình ảnh hình vuông của một con cá hồi, ban đầu được 300 điểm ảnh chiều cao.

 | footer = Cả hai hình ảnh đã được trả lại với cùng một chiều cao, và một tổng chiều rộng 320px
}}

Nhiều hàng[sửa mã nguồn]

To create an array of images, with multiple rows, use |perrow=. The value passed to |perrow= may be a single number, or a list of numbers delimited by /. This feature may also be combined with |total_width= for multiple rows of images with the same total width.

Thiết bị khảo sát. Chiều kim đồng hồ từ phía trên bên trái: máy kinh vĩ quang, tổng số trạm robotic, mức độ quang học, trạm RTK căn cứ GPS.
{{nhiều hình|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 = Thiết bị khảo sát. Chiều kim đồng hồ từ phía trên bên trái: máy kinh vĩ quang, tổng số trạm robotic, mức độ quang học, trạm [[Thời gian thực động học|RTK]] căn cứ GPS.
}}

Dữ liệu bản mẫu[sửa mã nguồn]

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho Nhiều hình

This template creates a box with two to ten images arranged vertically or horizontally with captions for the entire box and/or for each images.
Tham sốMiêu tảKiểuTrạng thái
Alignmentalign
Sets text-wrapping around image box, where "none" places the box on the left edge with no text-wrapping, "center" places the box at center with no text-wrapping and "left" and "right" refer to position of box on screen with text-wrapping.
Mặc định
right
Ví dụ
left/right/center/none
Chuỗi dàikhuyên dùng
Directiondirection
Direction in which to tile the images.
Mặc định
horizontal
Ví dụ
horizontal/vertical
Chuỗi dàikhuyên dùng
Widthwidth
Width overrides Width 1, Width 2, Width 3, etc. If you want the images to be different sizes, do not provide the width parameter. Integer width in pixels; no "px" suffix
Ví dụ
200
Chuỗi dàikhuyên dùng
Background colorbackground color
Defines the background color between the border of the box and the images.
Chuỗi dàitùy chọn
Caption alignmentcaption_align
Mặc định
left
Ví dụ
left/right/center
Chuỗi dàitùy chọn
Header backgroundheader_backgroundChuỗi dàitùy chọn
Header alignmentheader_align
Mặc định
center
Ví dụ
left/right/center
Chuỗi dàitùy chọn
HeaderheaderChuỗi dàitùy chọn
Image 1image1
Image 1 is name of first image. Similarly for Image 2, etc. File name only; no "File:" or "Image:" prefix.
Ví dụ
example.jpg
Chuỗi dàikhuyên dùng
Width 1width1
width 1 is width of first image. Similarly for Width 2, etc.
Sốtùy chọn
Alt text 1alt1
The alt text of first image (see WP:ALT). Similarly for Alt text 2, etc.
Chuỗi dàitùy chọn
Caption 1caption1
Caption 1 is caption of first image. Similarly for Caption 2, etc.
Chuỗi dàikhuyên dùng
Link 1link1
Where the first page links to. Similarly for Link 2, etc. If not specified, image links to the image description page as usual. If specified to the empty value, the image does not link anywhere; this should be used for purely decorative images as per WP:ALT. Important: If the image is under a free license like the GFDL or a CC license, you must not use this parameter as the terms of those licenses require the license, or a link to it, to be reproduced with the image. The image must, therefore, link to its image page. Public domain and (theoretically) fair use images are not subject to this restriction.
Tên trangtùy chọn
Thumbtime 1thumbtime1
If image1 is an Ogg Theora file, sets the time within the video that is used for the initial display. Either a number of seconds or hours:minutes:seconds. Similarly for Thumb time 2, etc.
Chuỗi dàitùy chọn
Image 2image2
Ví dụ
example.jpg
Chuỗi dàikhuyên dùng
Width 2width2Sốtùy chọn
Alt text 2alt2Chuỗi dàitùy chọn
Caption 2caption2Chuỗi dàikhuyên dùng
Link 2link2Tên trangtùy chọn
Thumbtime 2thumbtime2Chuỗi dàitùy chọn
Image 3image3
Ví dụ
example.jpg
Chuỗi dàitùy chọn
Width 3width3Sốtùy chọn
Alt text 3alt3Chuỗi dàitùy chọn
Caption 3caption3Chuỗi dàitùy chọn
Link 3link3Tên trangtùy chọn
Thumbtime 3thumbtime3Chuỗi dàitùy chọn
Footer backgroundfooter_backgroundChuỗi dàitùy chọn
Footer alignmentfooter_align
Mặc định
left
Ví dụ
left/right/center
Chuỗi dàitùy chọn
FooterfooterChuỗi dàitùy chọn

Định dạng: block

Thử nghiệm của đầu ra Dữ liệu bản mẫu raw:

This template creates a box with two to ten images arranged vertically or horizontally with captions for the entire box and/or for each images.

Tham số bản mẫu

Nên dùng bản mẫu này với các tham số đặt thành khối.

Tham sốMiêu tảKiểuTrạng thái
Alignmentalign

Sets text-wrapping around image box, where "none" places the box on the left edge with no text-wrapping, "center" places the box at center with no text-wrapping and "left" and "right" refer to position of box on screen with text-wrapping.

Mặc định
right
Ví dụ
left/right/center/none
Chuỗi dàikhuyên dùng
Directiondirection

Direction in which to tile the images.

Mặc định
horizontal
Ví dụ
horizontal/vertical
Chuỗi dàikhuyên dùng
Widthwidth

Width overrides Width 1, Width 2, Width 3, etc. If you want the images to be different sizes, do not provide the width parameter. Integer width in pixels; no "px" suffix

Ví dụ
200
Chuỗi dàikhuyên dùng
Background colorbackground color

Defines the background color between the border of the box and the images.

Chuỗi dàitùy chọn
Caption alignmentcaption_align

không có miêu tả

Mặc định
left
Ví dụ
left/right/center
Chuỗi dàitùy chọn
Header backgroundheader_background

không có miêu tả

Chuỗi dàitùy chọn
Header alignmentheader_align

không có miêu tả

Mặc định
center
Ví dụ
left/right/center
Chuỗi dàitùy chọn
Headerheader

không có miêu tả

Chuỗi dàitùy chọn
Image 1image1

Image 1 is name of first image. Similarly for Image 2, etc. File name only; no "File:" or "Image:" prefix.

Ví dụ
example.jpg
Chuỗi dàikhuyên dùng
Width 1width1

width 1 is width of first image. Similarly for Width 2, etc.

Sốtùy chọn
Alt text 1alt1

The alt text of first image (see WP:ALT). Similarly for Alt text 2, etc.

Chuỗi dàitùy chọn
Caption 1caption1

Caption 1 is caption of first image. Similarly for Caption 2, etc.

Chuỗi dàikhuyên dùng
Link 1link1

Where the first page links to. Similarly for Link 2, etc. If not specified, image links to the image description page as usual. If specified to the empty value, the image does not link anywhere; this should be used for purely decorative images as per WP:ALT. Important: If the image is under a free license like the GFDL or a CC license, you must not use this parameter as the terms of those licenses require the license, or a link to it, to be reproduced with the image. The image must, therefore, link to its image page. Public domain and (theoretically) fair use images are not subject to this restriction.

Tên trangtùy chọn
Thumbtime 1thumbtime1

If image1 is an Ogg Theora file, sets the time within the video that is used for the initial display. Either a number of seconds or hours:minutes:seconds. Similarly for Thumb time 2, etc.

Chuỗi dàitùy chọn
Image 2image2

không có miêu tả

Ví dụ
example.jpg
Chuỗi dàikhuyên dùng
Width 2width2

không có miêu tả

Sốtùy chọn
Alt text 2alt2

không có miêu tả

Chuỗi dàitùy chọn
Caption 2caption2

không có miêu tả

Chuỗi dàikhuyên dùng
Link 2link2

không có miêu tả

Tên trangtùy chọn
Thumbtime 2thumbtime2

không có miêu tả

Chuỗi dàitùy chọn
Image 3image3

không có miêu tả

Ví dụ
example.jpg
Chuỗi dàitùy chọn
Width 3width3

không có miêu tả

Sốtùy chọn
Alt text 3alt3

không có miêu tả

Chuỗi dàitùy chọn
Caption 3caption3

không có miêu tả

Chuỗi dàitùy chọn
Link 3link3

không có miêu tả

Tên trangtùy chọn
Thumbtime 3thumbtime3

không có miêu tả

Chuỗi dàitùy chọn
Footer backgroundfooter_background

không có miêu tả

Chuỗi dàitùy chọn
Footer alignmentfooter_align

không có miêu tả

Mặc định
left
Ví dụ
left/right/center
Chuỗi dàitùy chọn
Footerfooter

không có miêu tả

Chuỗi dàitùy chọn

Xem thêm[sửa mã nguồn]