Action: Gallery
Compatible with: R6.1 Current version: 0.10 Credits: WikiAdmin[link1] Moved to core, except the lightbox. |
{{gallery}}
1. Description
Gallery action allows you to create a photo gallery with small pictures, linked to larger versions. Gallery uses standard WackoWiki file model.2. Requirements
- PHP 8.0 and GD 2.2+
- PHP Thumb Library
- folder
file/thumb
andfile/thumb_local
3. Configuration
- Admin Panel[link2] settings
-
img_create_thumbnail
-
img_max_thumb_width
-
- make the tumbs folders writable
chmod 0755 file/thumb/ file/thumb_local/
3.1. PhotoSwipe
see gallery.php// Include Lightbox import PhotoSwipeLightbox from '{$this->db->base_path}js/photoswipe/photoswipe-lightbox.esm.min.js'; import PhotoSwipeDynamicCaption from '{$this->db->base_path}js/photoswipe/photoswipe-dynamic-caption-plugin.esm.min.js'; const lightbox = new PhotoSwipeLightbox({ // may select multiple "galleries" gallery: '#gallery--$param_token', // Elements within gallery (slides) children: 'a', // setup PhotoSwipe Core dynamic import pswpModule: () => import('{$this->db->base_path}js/photoswipe/photoswipe.esm.min.js') }); const captionPlugin = new PhotoSwipeDynamicCaption(lightbox, { // Plugins options, for example: type: 'auto', captionContent: '.pswp-caption-content', }); lightbox.init();
4. Download
- optional (for lightbox)
- photoswipe_5.4.2.zip[link3] (add here:
js/photoswipe/
)- PhotoSwipe[link4] — JavaScript image gallery and lightbox
- photoswipe.css
- photoswipe.esm.min.js
- photoswipe-lightbox.esm.min.js
- Caption plugin[link5]
- photoswipe-dynamic-caption-plugin.css
- photoswipe-dynamic-caption-plugin.esm.min.js
- PhotoSwipe[link4] — JavaScript image gallery and lightbox
- photoswipe_5.4.2.zip[link3] (add here:
5. Installation
- Unpack and copy PhotoSwipe to js/photoswipe/ directory (optional)
6. Using
Then you call action{{gallery}}
with params:[page = "page_tag"]
- call image from another page[global = 1]
- show global files[perrow = <Number of images per rows> ]
(default = 3)[caption = 1|2]
- show 1
file descriptions, 2
file caption[title = "Gallery"]
- album title[target = 1|2]
- show large images without page (0
- inline (default) , 1
- image, 2
- lightbox)[nomark = 1]
- hide external border[table = 1]
- pictures in table[order = "time|name_desc|size|size_desc|ext"]
[owner = "UserName"]
[max = number]
6.1. Lightbox
Set the parametertarget=2
to use the lightbox.The lightbox only works if the user allows JavaScript in their browser, otherwise it would load the image directly in a new tab.
6.2. Examples
{{gallery table=1 target=2 title="local pictures"}}
-> Example for Testing[link6]
7. Changelog
0.1 Intitial version0.7 Updated to work with R.6.1 (PHP 8.0, Null coalescing assignment operator)
0.8 added
order="name_desc"
and changed time field names0.9 added support for PhotoSwipe
0.10 moved action to core
8. ToDo
-
add it to the coreDONE
9. Links
- gallery action
- action/gallery.php[link7]
- action/template/gallery.tpl[link8]
- PHP Thumb Library[link9] (part of distribution)
- PhotoSwipe[link10] [MIT License]
- PhotoSwipe Documentation[link11]
- PhotoSwipe Dynamic caption plugin[link5]
9.1. Lightbox Alternatives
Others- https://github.com/sachinchoolur/lightGallery [GPL3]
- https://github.com/andreknieriem/simplelightbox [MIT]
- [link1] https://wackowiki.org/doc/Users?profile=WikiAdmin
- [link2] https://wackowiki.org/doc/Doc/English/AdminPanel
- [link3] https://wackowiki.org/doc/Dev/PatchesHacks/Gallery/file?get=photoswipe_5.4.2.zip
- [link4] https://github.com/dimsemenov/PhotoSwipe/tree/master/dist
- [link5] https://github.com/dimsemenov/photoswipe-dynamic-caption-plugin
- [link6] https://wackowiki.org/doc/Dev/PatchesHacks/Gallery/Example
- [link7] https://bitbucket.org/wackowiki/wackowiki/src/master/src/action/gallery.php
- [link8] https://bitbucket.org/wackowiki/wackowiki/src/master/src/action/template/gallery.tpl
- [link9] https://github.com/PHPThumb/PHPThumb
- [link10] https://github.com/dimsemenov/PhotoSwipe
- [link11] https://photoswipe.com/