FANDOM


GalleryPreview is a module that generates a brief gallery preview onto an article page from a designated gallery page.


Install

Installing modules

To get a brief introduction to lua read the basics page first. On Wikia, one can use modules by either accessing a module remotely or copying all its contents to a Wiki. Modules accessed remotely from dev.wikia are subject to change while 'correctly' copied modules are controlled by a particular wiki.

Using a module "remotely" using Module:Devmodule

Create Module:Devmodule and copy the following code to remotely access modules in dev's repository. See more details in Global Lua Modules/Devmodule.
--[[This imports modules from dev.wikia]]
return require("Dev:Devmodule")

Loading modules remotely from dev.wikia

Create Module:GalleryPreview in your wiki and add the following code:
--This loads modules directly from dev.wikia.com
return require("Dev:GalleryPreview")

Using Module:GalleryPreview in another wiki

To use modules without depending on dev see this page. Create Template:GalleryPreview in your wiki and add the following code:
{{#invoke:GalleryPreview|main}}

Using template in a page

You can use this module in a page using syntax such as:
{{GalleryPreview|main|arg1|arg2}}

Module information

Functions

argChecker

Creates a metatable wrapper for checking arguments.
Parameters
NameTypepurpose
frArgstableThe arguments table from a frame object. (i.e. frame.args).
Return typeReturn purpose
table"Wrapped" table. Arguments my be indexed with membership operator.

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 Global Lua Modules/GalleryPreview/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 Global Lua Modules/GalleryPreview exists yet! You can create it here.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.