====== Gallery Plugin ====== ---- plugin ---- description: This Syntax Plugin allows you to embed an automatically created image gallery into a page author : Andreas Gohr email : andi@splitbrain.org type : syntax lastupdate : 2024-04-30 compatible : !greebo, !hogfather, !igor, Jack Jackrum, Kaos depends : conflicts : similar : tags : media, images, gallery, namespace, feed, embed, listing downloadurl: https://github.com/splitbrain/dokuwiki-plugin-gallery/zipball/master sourcerepo : https://github.com/splitbrain/dokuwiki-plugin-gallery bugtracker : https://github.com/splitbrain/dokuwiki-plugin-gallery/issues donationurl: http://donate.dokuwiki.org/Gallery screenshot_img: https://i.imgur.com/rj4v2c3.png ---- This plugin shows a list of image thumbnails linking to larger versions of the image. ===== Download ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. ==== Requirements ==== Your wiki needs to be able to resize images. Either by having the GD PHP extension installed or by configuring the [[config:im_convert]] option. Additionally, to have thumbnail creation work for external images you need to set [[config:fetchsize]] big enough to get the remote images downloaded. ==== Changes ==== {{rss>https://github.com/splitbrain/dokuwiki-plugin-gallery/commits/master.atom date}} ===== Syntax ===== Images can be selected via three different sources and accept various [[#alignment|alignments]] and [[#options]]. ==== Source: Namespace/Image ==== A gallery can be added by selecting a [[:namespaces|namespace]] like this: {{gallery>:namespace}} 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. {{gallery>:namespace:someimage.jpg}} [[#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 [[wp>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: {{gallery>https://www.23hq.com/rss/schabloni}} 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 [[https://bit.ly]]. Again, options are added after a question mark ''?''. {{gallery>https://www.23hq.com/rss/schabloni?options 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. :somenamespace:image.jpg https://example.com/anotherimage.jpg 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. :somenamespace:image.jpg My Horse | Look at my horse, it's amazing! https://example.com/anotherimage.jpg Just a Title ==== Alignment ==== 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) ==== Options ==== 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 ^ | ''////x////'' | ''%%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. | | ''////X////'' | ''%%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. | | ''////'' | ''0'' | The number images per row in the gallery table. If you specify a 0, images are fit automatically. | | ''=////'' | ''=0'' | Limits the output to the given number of images. ''0'' means all. | | ''+////'' | ''+0'' | Skip the first number of images. Useful with the option above. | | ''~////'' | ''~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 [[:caching|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 | === Example === {{gallery>images:vacation?image_*.jpg&80x80&nocrop&showtitle}} This displays all images beginning with ''image_'' and ending in ''.jpg'' from the namespace ''images:vacation''. Thumbnails are not cropped but fit into a 80x80 pixel bounding box. Image titles will be shown in the gallery. === Example === {{gallery>?crop&lightbox}} 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 mediamanager|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|media manager popup]] or [[:fullscreen mediamanager|fullscreen media manager]] to upload multiple image at once with compatible browsers, otherwise one by one. * Use the [[plugin: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! ==== Caching ==== 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 [[config: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|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. ==== Lightbox Problems ==== 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 [[faq: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 [[config:im_convert|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 [[config:fetchsize]] config option. Also make sure LibGD or ImageMagick are installed. ===== Discussion ===== Be sure to read the [[#Known Limitations and Caveats]] section first. Questions should be asked in the [[https://forum.dokuwiki.org|forum]]. Bugs and feature wishes should be reported in the [[https://github.com/splitbrain/dokuwiki-plugin-gallery/issues|issue tracker]]. Any comments/discussions on this page will be removed.