Help:Gallery format

From Linux Web Expert

Revision as of 04:03, 26 April 2020 by >Kghbln (form)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Gallery format
Display images as a gallery
Scenarios, examples, demos
Example: Examples
Further Information
Provided by: Semantic Result Formats
Added: 1.5.0
Removed: still supported
Requirements: none
Format name: gallery
Enabled? Indicates whether the result format is enabled by default upon installation of the respective extension. yes
Authors: Rowan Rodrik van der Molen , Jeroen De Dauw , James Hong Kong
Categories: media
Group:
,
,
Table of Contents

The result format gallery, part of the Semantic Result Formats extension, displays query results as dynamic galleries with output which is the same as when using MediaWiki's built-in <gallery> tag.

Parameters

General

⧼validator-describe-header-parameter⧽ ⧼validator-describe-header-type⧽ ⧼validator-describe-header-default⧽ ⧼validator-describe-header-description⧽
source ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ Alternative query source
limit ⧼validator-type-integer⧽ 50 The maximum number of results to return
offset ⧼validator-type-integer⧽ 0 The offset of the first result
link ⧼validator-type-string⧽ all Show values as links
sort ⧼validator-type-string-list⧽ ⧼validator-describe-empty⧽ Property to sort the query by
order ⧼validator-type-string-list⧽ ⧼validator-describe-empty⧽ Order of the query sort
headers ⧼validator-type-string⧽ show Display the headers/property names
mainlabel ⧼validator-type-string⧽ no The label to give to the main page name
intro ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The text to display before the query results, if there are any
outro ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The text to display after the query results, if there are any
searchlabel ⧼validator-type-string⧽ ... further results Text for continuing the search
default ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The text to display if there are no query results

Format specific

⧼validator-describe-header-parameter⧽ ⧼validator-describe-header-type⧽ ⧼validator-describe-header-default⧽ ⧼validator-describe-header-description⧽
class ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ Specify an additional cascading style sheet class
widget ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ Available widget
navigation ⧼validator-type-string⧽ nav Layout navigation control
overlay ⧼validator-type-boolean⧽ no Enable image overlay
perrow ⧼validator-type-integer⧽ ⧼validator-describe-empty⧽ The amount of images per row
widths ⧼validator-type-integer⧽ ⧼validator-describe-empty⧽ The width of the images
heights ⧼validator-type-integer⧽ ⧼validator-describe-empty⧽ The height of the images
autocaptions ⧼validator-type-boolean⧽ yes Use filename as caption when none is provided
fileextensions ⧼validator-type-boolean⧽ no When using the filename as caption, also display the file extension
captionproperty ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The name of a semantic property present on the queried pages to be used as caption
captiontemplate ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ A template used to format the gallery image captions. It provides named args like 'imageraw', 'imagecaption' and 'imageredirect'
imageproperty ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ Name of a semantic property on the queried pages that points to images to use. When set, the queried pages themselves will not be displayed as images
redirects ⧼validator-type-string⧽ ⧼validator-describe-empty⧽ The name of a semantic property present on the queried pages which contain the redirect target
Available values for the parameters listed above:
  • widget: carousel, slideshow
  • navigation: nav, pager, auto
The overlay parameter cannot be used if extension "MultimediaViewer" (MediaWiki.org) is installed for the wiki due to an incompatibility.

Usage

You can create a gallery either by querying pages of images in namespace "File", or by querying image names which are a property of other pages.

Querying image pages

To generate a simple gallery of all images whose image pages have been categorized as "Photographs", you could use the following syntax:

{{#ask: [[Category:Photographs]] | format=gallery}}

Simulated result:

If you query a property for the image pages, it'll be used as the caption. The value of the property "Has description", as declared on the image pages, will become the caption in this example:

{{#ask: [[Category:Photographs]] | ?Has description | format=gallery}}

Simulated result:

If you want your gallery to have a caption of its own, use the "intro" parameter:

{{#ask: [[Category:Photographs]] | ?Has description | format=gallery | intro=This is a gallery caption}}

Simulated result:

Now adjust the widths of the images to 60 pixels:

{{#ask: [[Category:Photographs]] | ?Has description | format=gallery | intro=This is a gallery caption | widths=60}}

Simulated result:

Querying image names as properties

The gallery format can also display images named by properties on your pages. You must add the property to be queried to your pages or subobjects using a property of datatype "Page"Holds names of wiki pages, and displays them as a link, including namespace prefix "File:", as shown in this example:

[[Has image::File:Example.jpg]]

Your query must have two parts: a printout statement returning the value of the property holding the page name of the image, and a parameter mapping this printout to the respective property called "imageproperty". You may optionally specify a property containing a caption to the mapping parameter called "captionproperty".

This example will return a gallery of images named by the "Has image" property, specified on pages in the category "Events":

{{#ask:
 [[Category:Events]]
 |?Has image
 |format=gallery
 |imageproperty=Has image
}}

This example will show images from the current page with their captions:

{{#ask:
 [[{{PAGENAME}}]]
 |?Has image
 |?Has caption
 |format=gallery
 |imageproperty=Has image
 |captionproperty=Has caption
}}

Carousel widget

Display a gallery as carousel, using widget=carousel. Some examples an can be found here.

Slideshow widget

Display a gallery as slideshow, using widget=slideshow. Some examples can be found here.

Redirects

Using option redirects=- or a property such as (e.g redirects=Has redirect) will allow images within a gallery to be redirected. The icon [ Indication of a redirect target ] will indicate if an image is forwarded to a different target while each embbeded icon will point to its original image. Examples can be found here and be combined with the carousel widget, and the slideshow widget.

Wikipage

Images with a redirect property of type page are forwarded to its wikipage destination.

URL

Images with a redirect property of type URL are forwarded to its URL destination.

Overlay

The overlay option allows to display images as fancybox overlay image in its original size. The icon [ File:Srf-format-gallery-icon-overlay.png ] will indicate if an image is available as overlay while the embedded icon will point to the original imag. Examples can be found throughout the entire wiki such as here and be combined with the standard SRF gallery, the carousel widget, and the slideshow widget.

Note

The overlay and redirects option are mutually exclusive and in case both options are used within a query, the overlay option will take precedence over the redirects option.

Overlay and redirects need to gather additional information (URL of the original image etc.) which is done in an asynchronous mode therefore to improve accessibility and ease server response latency both features make use of jStorage, a cross-browser key-value store that stores URL data 24h locally in the browser.

Examples

See also