Archive:Gallery format 1.5.0 - 1.7.1

From semantic-mediawiki.org


Property "Namespace" has a restricted application area and cannot be used as annotation property by a user."-" is not a number.

This documentation page applies to all SMW versions from 1.5.0 to 1.7.1.
      Other languages: zh-hans

Help:Gallery format en 1.5.0 1.7.1


Gallery format 1.5.0 - 1.7.1
displays query results as dynamic galleries with output which is the same as when using MediaWiki's built-in gallery tag.
Scenarios, examples, demos
Example: Demo:Gallery
Further Information
Provided by: Extension "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: misc
Table of Contents

The result format gallery, part of the Extension "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

⧼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

Usage

You can create a gallery either by querying image pages, 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 60px:

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

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 using the "Has" syntax, including "File:", as shown in this example:

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

Your query must have two parts: a query for the existence of the property, using a "?", and a query for the name of the property, using "imageproperty". You may optionally specify a property containing a caption: "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
}}


Examples

External examples

Pre-release information

Indication of a redirect target This icon will indicate a different target than the image itself.

This icon will indicate that an image is available as overlay.

Bug tracking

Description: Add new galleryformat (carousel support) Status : deployed Contact : James Hong Kong (Tracking request: 34411)

Description: Add new galleryformat (slideshow support) Status : deployed Contact : James Hong Kong (Tracking request: 38184)


Cookies help us deliver our services. By using our services, you agree to our use of cookies.