Extension:Semantic Result Formats/gallery format

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   tag.

Parameters
Semantic Gallery also respects the following parameters (which mean the same as they do when using them with the   tag):
 * perrow: to define how many thumbnails are shown in each row of the gallery,
 * heights: to set the maximum height (in pixels) of the thumbnails, and
 * widths: to set the maximum width of each thumbnail.
 * autocaptions: by default when you do not provide a caption, the image name will be used. Set this parameter to 'off' to prevent this.
 * captionproperty: The name of a semantic property present on the queried pages to be used as caption (since 1.5.3)
 * imageproperty: 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 (since 1.5.3)
 * fileextensions: When using the filename as caption, also display the file extension. (since 1.6)

SMW parameters

 * intro: is used as global gallery caption.

Query
You can create a gallery either by querying image pages, or by querying the names of images as a property.

Querying image pages
To generate a simple gallery of all images in the 'Photographs' category, you could use the following:

If you query a property for the image pages, it'll be used as caption.

External sites with examples

 * Event pages on the 0x20 wiki: wikitext - result
 * Hardhoutbeleggingen Wiki - A Dutch-language wiki about hardwood investments. (Example page)
 * Timber Investments Wiki - An English-language version of the same. (Example page)

Querying image names as properties
If you have one or more pages that have multiple 'Has image' or similar properties, you can use the gallery format to display the images pointed by these properties. You need to specify which property contains the image names: imageproperty, and can optionally specify one that contains the captions: captionproperty.

This example will get you a gallery of images from pages in the events category:

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

To-do

 * Do something intelligent when the inline query has no results.
 * Do something intelligent when the inline query has more results than the "limit" parameter allows.

External examples

 * Ohinternet - uses the imageproperty parameter and queries SIOs (query wikitext)