It's better when it's simple

User Tools

Site Tools


Gallery Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" yes
  • 2023-04-04 "Jack Jackrum" yes
  • 2022-07-31 "Igor" no
  • 2020-07-29 "Hogfather" no

plugin This Syntax Plugin allows you to embed an automatically created image gallery into a page

Last updated on
Conflicts with
galleryv1.5, lightbox

This plugin shows a list of image thumbnails linking to larger versions of the image.


Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.


Your wiki needs to be able to resize images. Either by having the GD PHP extension installed or by configuring the im_convert option.

Additionally, to have thumbnail creation work for external images you need to set fetchsize big enough to get the remote images downloaded.



Images can be selected via three different sources and accept various alignments and options.

Source: Namespace/Image

A gallery can be added by selecting a namespace like this:


All image files in the selected namespace will be added to the image gallery. Don't forget the “:” in front of the namespace.

Instead of using a whole namespace of images, you can also specify a single image.


Options (see below) are added after the namespace/image, separate by a question mark ?.

{{gallery>:namespace:someimage.jpg?options go here}}

Source: Media Feed

Instead of a namespace, you can also give an HTTP(s) URL to any Media RSS or ATOM feed with enclosures (as produced by most photo sharing sites like Flickr). The images will then be pulled from that feed instead:


Note: since the question mark is used to separate the options (see below), the URL can not contain any question mark. To use such a feed URL with the gallery plugin, just use one of the many short URL services like

Again, options are added after a question mark ?.

{{gallery> go here}}

Source: Image List

A different syntax allows you to manually specify a list of images, with one line per image. Images can be local and external. options go into the opening tag in this case.

<gallery options go here>

This mode allows you to optionally manually set the title and caption of images. The title is separated by a space from the image name, the caption is separated by a pipe | from the title.

<gallery options go here>
:somenamespace:image.jpg My Horse | Look at my horse, it's amazing! Just a Title


The gallery can be aligned in 4 different ways:

  • full – This is a fully responsive layout and uses the full width of the page. The gallery will automatically be adjusted to fit. This is the default and recommended.
  • center – This centers the gallery on the page, using only as much space as needed. You probably want to manually set the number of columns.
  • left – Left aligns the gallery, floating follow-up content to the right. You probably want to manually set the number of columns.
  • right – Right aligns the gallery, floating follow-up content to the left. You probably want to manually set the number of columns.

The alignment can be set either by the above keyword in the options or by white space (except for list mode):

{{gallery> namespace?options}} (right aligned)
{{gallery>namespace?options }} (left aligned)
{{gallery> namespace?options }} (centered)


A number of parameters can be set by listing them as mentioned in the source sections above.

Each parameter can be separated with a & or space character. Defaults for all parameters can be set in the config manager. If a parameter is enabled by default it can be disabled in the syntax by prefixing it with the syllable no. E.g. the parameter cache is usually enabled and can be disabled using the keyword nocache. Below is a list of all recognized parameters

Parameter Default Description
<number>x<number> 150x150 Sets the size for thumbnails. Unless the crop option is set, this is a boundary box into which the thumbnail will be fitted, maintaining the correct aspect ratio.
<number>X<number> 1600X1200 Sets the maximum size for the images when shown in a lightbox. This is a boundary box into which the image will be fitted, maintaining the correct aspect ratio. Note the uppercase X. This is a maximum, the lightbox will automatically scale down the image to fit the screen size.
<number> 0 The number images per row in the gallery table. If you specify a 0, images are fit automatically.
=<number> =0 Limits the output to the given number of images. 0 means all.
+<number> +0 Skip the first number of images. Useful with the option above.
~<number> ~0 Add a pagination for the thumbnails displaying the number of given thumbnails per page. 0 disables pagination. Pagination is added through JavaScript - when no JavaScript is available all thumbnails are displayed
cache enabled Usually the output of the created gallery is cached. When the images in your selected namespace change, you have to manually force an update of the gallery page's cache. To disable the cache for the page showing the gallery, set nocache as option.
crop enabled Make thumbnails the exact given thumbnail size big, cropping when needed.
direct disabled Link thumbnails with their original instead of the detail page
lightbox enabled Show images in a fancy JavaScript modal browsing window, see below for details.
reverse disabled Reverse the order of the displayed images
recursive enabled Find images in the given namespace and all sub namespaces
random disabled Sort images randomly. You might want to use nocache as well
modsort disabled Sort images by file modification date
datesort disabled Sort images by EXIF creation date
titlesort disabled Sort images by EXIF title
showname disabled Show filename below thumbnails
showtitle disabled Show the EXIF tag Headline as title below thumbnails
showcaption disabled Show the EXIF tag Caption as caption below thumbnails
anything containing a * (asterisk) This can be used to filter the list of files found in the given namespace. * works as simple wildcard symbol.
full,left,center,right full Alignment as described above



This displays all images beginning with image_ and ending in .jpg from the namespace images:vacation. Thumbnails are not cropped but fit into a 80×80 pixel bounding box. Image titles will be shown in the gallery.



This displays all images in the current namespace using 2 parameters. Parameterlist begins with ? additional ones are concatenated with &.

About the Lightbox mode

This mode will open the clicked picture inside the current browser window without leaving the current page.

You can close the picture view by clicking the X button in the upper right corner. You can move to the next or previous image by using the arrow buttons in the lower bar. You can also use the keyboard shortcuts listed below for navigation and closing.

Mobile users can swipe to navigate and use the back button to close the gallery.

Shown images can be zoomed using the mousewheel or a pinch gesture on mobile phones.

The following keys can be used to navigate:

Key Action
next image
previous image
ESC close the image view

On Titles and Captions

For internal images, titles and captions are read from the EXIF/IPTC tags. This is meta data within the image files. In DokuWiki this metadata is only available for JPEG images. You can edit the metadata in the fullscreen media manager.

The Source: Image List allows you to manually set the title and caption for each listed image.

Known Limitations and Caveats

Uploading Images

Uploading images is beyond the scope of this plugin. Do not request any features regarding this.

  • Use the media manager popup or fullscreen media manager to upload multiple image at once with compatible browsers, otherwise one by one.
  • Use the archiveupload plugin to upload multiple images in a Zip file
  • Upload the files manually via FTP to the data/media directory. Keep in mind that image names need to be valid pagenames, all lowercase, no spaces or special chars!


The gallery output is cached by default. When you add pictures later, they may not show up immediately in the gallery. Either wait until the cachetime has been reached or add the purge=true parameter to the end of the URL to clear the cache. See caching for details.

Optionally use the nocache parameter of the plugin (usually not recommended).

EXIF Data Problems

Problems with accessing EXIF or IPTC data in the images, should be reported as DokuWiki bugs and not for this plugin. All EXIF handling is in DokuWiki core. Currently EXIF Data is expected in UTF-8 encoding.

Note that the EXIF parser requires XML support in your PHP for some parsing. If you get undefined function xml_parser_create errors, be sure to install and enable the XML extension.

When the lightbox mode doesn't work and instead images are simply opened in the same window, the JavaScript was not correctly loaded. This is most likely a Browser-Cache issue. Simply follow the steps described for fixing a similar problem with the toolbar. Also make sure you don't have any conflicting plugin installed. You should not install any additional lightbox plugin.

Images are not Resized

There are different reasons why thumbnails are not created:

  • libGD extension is missing ⇒ Install the extension or configure DokuWiki to use imagemagick
  • libGD extension is installed, but the source image size + overhead is larger than memory_limit set in php.ini ⇒ Lower the source image size or increase the memory_limit

MediaRSS feed displays "nothing found"

When no images from your feed are shown, be sure you don't have a question mark in your URL. Use an URL shortener as suggested above. Also be sure your feed URL (before shortening) starts with http:// or https:// and not with feed://. The latter is just a renamed HTTP link - simply rename it back.

External Images are not Resized

As written above, you need to increase the fetchsize config option. Also make sure LibGD or ImageMagick are installed.


Be sure to read the Known Limitations and Caveats section first. Questions should be asked in the forum. Bugs and feature wishes should be reported in the issue tracker. Any comments/discussions on this page will be removed.

plugin/gallery.txt · Last modified: 2024-05-01 23:50 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki