Global Lua Modules/GalleryPreview

GalleryPreview is a module that generates a brief gallery preview onto an article page from a designated gallery page.
== Usage ==
It is suggested that GalleryPreview is invoked through a template.
The generated gallery may be configured similarly to galleries. These setting customizations must be passed through the settings parameter in the following format:
option1: "value",
option2: "value2"
=== Arguments ===
==== Required ====
;gallery_page
:Link to a page's associated gallery page. Should not be enclosed by brackets.
;number_of_images
:The number of images to select randomly and include in the generated gallery. If this number exceeds the number of images on the gallery page, the generated gallery will include all images from the gallery page.
==== Optional ====
;default
:The text to be shown if gallery_page links to a non-existent page. If not provided, the module has its own built-in default.
;portal_image
:"Portal" image to include in the generated gallery that will link to gallery_page. This will be the last image in the generated gallery, and is counted towards the number_of_images limit.
;include_caption
:If any value is passed through this parameter, images on the generated gallery will retain their associated caption from the source gallery. By default, captions are not included.
;settings
:Gallery customization pairs formatted as option: "value". See #Usage above. By default, the gallery is formatted to be centered, navigation set to true, and to exclude the "add to gallery" button.
=== Examples ===
:This example generates a gallery from images in /Gallery testing.
{{#invoke:GalleryPreview|main
| gallery_page = {{FULLPAGENAME}}/Gallery testing
| number_of_images = 3
| default = Whelp, looks like the testing page was deleted.
| include_caption = y
| settings =
 bordersize: "medium"
}}
gives...
----
{{#invoke:GalleryPreview|main
| gallery_page = Some non-existent page
| number_of_images = 5
}}
gives...
No gallery for exists yet! You can create it here.