Gallery Macro

The Gallery macro displays a collection of thumbnail images in a table, based on the images attached to a Confluence page. When viewing the page, a user can click a thumbnail image to zoom into a screen-sized image and then view the images as a slide show.

Overview:

  • The images shown in the gallery are taken from the files attached to the Confluence page. You can also specify a different page where the attachments are located. For information about attaching images to a page, see Upload Files.
  • The captions below the images are drawn from the comments on the attachments. For information about adding comments to attachments, see Upload Files.
  • By default, the gallery will include all the images attached to the page. You can also exclude or include images using parameters.
  • You can sort your images into a particular order.
  • You can specify a title for the gallery and also configure how many columns you want for the table in which your images are displayed.

Illustration: Live example of the Gallery macro

Using the Gallery macro

To insert the Gallery macro onto a page:

  1. In the Confluence editor, choose Insert > Other Macros
  2. Find and select the required macro

Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Autocomplete for links, files, macros and mentions.

To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.

Parameters

Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).  

The full list of parameters is shown in the following table. If the name of an attached file or page contains a comma, you can refer to it in the relevant parameters below by enclosing it in single or double quotes, for example "this,that.jpg", theother.png

Parameter

Default

Description

Gallery Title
(title

Nothing

Specify a title for your gallery.

Number of Columns
(columns

4

Specify the number of columns for your table.

Images to Exclude
(exclude

No exclusions. Include all the pictures on the page.

The gallery will ignore any pictures specified. You can specify more than one picture, separated by commas.
Note: The filename and filetype for this parameter are case-sensitive. For example, 'my picture.PNG' will not be recognized as 'my picture.png'.

Include these Images Only
(include

Include all the pictures on the page.

If you specifically include one or more pictures, the gallery will show only those pictures. You can specify more than one picture, separated by commas.
Note: The filename and filetype for this parameter are case-sensitive. For example, 'my picture.PNG' will not be recognized as 'my picture.png'.

Exclude Images with these Labels
(excludeLabel

No exclusions. Include all the pictures on the page.

The gallery will ignore any pictures that have the specified label. You can specify more than one label, separated by commas. For information on labeling the attachments, see Add, Remove and Search for Labels.
Include Images with these Labels Only
(includeLabel
None. The images are not filtered by label.

Filters the images to display, based on a list of labels. Separate multiple labels with commas. Confluence will show any image that has at least one of the labels you specify (it's an OR match as opposed to an AND).

For information on labeling the attachments, see Add, Remove and Search for Labels.

Use Images in these Pages
(page

If no page is specified, the gallery macro displays the images attached to the page on which the macro is used.

Specify the title of the page which contains the images you want displayed. You can specify more than one page name, separated by commas. To specify a page in a different space, use the following syntax: SPACEKEY:Page Title

Sort Images By
(sort

None. The sort order is unspecified and therefore unpredictable.

Specify an attribute to sort the images by. Sort order is ascending, unless you select the Reverse Sort parameter (see below). Options are:

  • name – file name.
  • comment – comment linked to the attached file.
  • date – date/time last modified.
  • size – size of the attached file.

Reverse Sort
(reverse

Off. Sort order is ascending

Used in combination with the Sort Images By parameter above. Use Reverse Sort to reverse the sort order, from ascending to descending.

Available values in storage format and wikimarkup:

  • true – Sort order is descending.
  • false – Sort order is ascending.

Image file formats

You can attach image files of any format to a page. Confluence supports the following image formats in the Gallery macro and when displaying an image on a page:
  • gif
  • jpeg
  • png
  • bmp (depending on browser support)

Code examples

The following examples are provided for advanced users who want to inspect or edit the underlying markup for a Confluence page. 

Macro name: gallery

Macro body: None.

Storage format example

<ac:structured-macro ac:name="gallery">
  <ac:parameter ac:name="title">My holiday pictures</ac:parameter>
  <ac:parameter ac:name="reverse">true</ac:parameter>
  <ac:parameter ac:name="sort">size</ac:parameter>
  <ac:parameter ac:name="page">My page1, ds:Welcome to Confluence</ac:parameter>
  <ac:parameter ac:name="excludeLabel">badlabel1, badlabel2</ac:parameter>
  <ac:parameter ac:name="columns">3</ac:parameter>
  <ac:parameter ac:name="exclude">badpicture.png</ac:parameter>
</ac:structured-macro>

Wiki markup example

{gallery:title=My holiday pictures|reverse=true|sort=size|page=My page1, ds:Welcome to Confluence|excludeLabel=badlabel1, badlabel2|columns=3|exclude=badpicture.png}

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport