Gallery Macro

Version 23.4 by Vincent Massol on 2019/06/05 14:41
Warning: For security reasons, the document is displayed in restricted mode as it is not the current version. There may be differences and errors due to this.

cogDisplays an image gallery
TypeJAR
Category
Developed by

XWiki Development Team

Rating
3 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

XWiki Enterprise >= 3.0 Milestone 3

Description

Images are collected from the macro content and displayed using a slide-show view. Thus this macro content can contain any content in the current syntax and only images will be extracted and displayed in the slide show.

Usage

{{gallery}}
image:alice.png
image:[email protected]
image:http://www.xwiki.org/logo.png
[[image:Path.To My [email protected]]]
{{/gallery}}

Note that any markup syntax (including macros) that generates HTML <img> will have these images included in the gallery view (see the RSS example below for this usage).

Shortcut Keys

Display previous image

Display next image

Home

Display first image

End

Display last image

F

Toggle full-screen view

Esc

Exit full-screen view

Parameters

NameDescriptionDefault ValueSince
classCustom CSS class names to set on the gallery container. Use this parameter if you want to customize the appearance of a gallery instance.8.3RC1
heightThe gallery height. Empty value means no explicit height set.349px8.3RC1
widthThe gallery width. Empty value means no explicit width set.620px8.3RC1

Examples

Displays all the images attached to the current page

You can also use the Attachment Gallery Macro which does exactly that and which can be used as a shortcut.

{{velocity}}
#set ($attachments = $doc.attachmentList)
#if ($attachments.size() > 0)
  {{gallery}}
    #foreach($attachment in $attachments)
      #if($attachment.isImage())
        [[image:$attachment.filename]]
      #end
  #end
  {{/gallery}}
#end
{{/velocity}}

Result:

screenshot.png

Displays images from a RSS feed

Example using a Flickr feed.

{{gallery}}
{{rss feed="http://api.flickr.com/services/feeds/photos_public.gne?format=rss_200&tags=xwiki" content="true" decoration="false"/}}
{{/gallery}}

The decoration="false" parameter is only available in XWiki 3.2+

Result:

flickrrss.png

Displays all images visible on a page

{{gallery}}
{{display reference="Sandbox.WebHome"/}}
{{/gallery}}

Use Bootstrap Grid System

{{gallery class="col-xs-12 col-sm-6 col-md-4 col-lg-3" width="" height="300px"}}
image:[email protected]
{{/gallery}}
    

Get Connected