Action: Gallery

bugs:
Compatible with: R6.0
Current version: 0.7
Credits:

{{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.


gallery action

2. Requirements

  1. PHP 7 and GD 2.0+
  2. PHP Thumb Library
  3. folder file/thumb

3. Configuration

  1. Admin Panel settings
    1. img_create_thumbnail
    2. img_max_thumb_width
  2. make the tumbs folder writable chmod 0755 file/thumb/
  3. router.conf: add fancybox
diff --git a/wacko/config/router.conf b/wacko/config/router.conf
--- a/wacko/config/router.conf
+++ b/wacko/config/router.conf
@@ -108,8 +108,9 @@
 `^(theme/{}/css|theme/_common|admin/style)/{}$`                _ok!            // css
 `^image/(wikiedit/)?{}$`                                    _ok!            // icons
 `^theme/default/icon/{}$`                                    _ok!            // icons
-`^js/(lang/)?{}$`                                            _ok!            // js
+`^js/(lang/|fancybox/)?{}$`                                    _ok!            // js
 `^file/(global/){}$`                                        _ok!            // global uploads
 `^setup/(image|css)/{}$`                                    _ok! unlock=1    // setup inlines
 `^xml/{}$`                                                    _ok! age=0        // feeds


Re-add this change after each Upgrade

Do not forget to add/merge the additional folder to the router.conf after each WackoWiki upgrade, otherwise the router will ignore the folder and the script will not load.


`^js/(lang/|fancybox/)?{}$` _ok!

4. Download

  1. for R6.0
    1. Repo: action/gallery.php (add here: action/)
    2. Repo: action/template/gallery.tpl (add here: action/template/)
  2. PHP Thumb Library (add here: lib/phpthumb/) (part of disribution)
  3. optional (for lightbox)
    1. jquery-3.6.0.min.js (add here: js/)
    2. fancyBox3 (add here: js/fancybox/)
      1. jquery.fancybox.min.css
      2. jquery.fancybox.min.js

5. Installation

  1. Copy gallery.php to action/ directory on your Wacko.
  2. Copy jQuery library to js/ directory
  3. Unpack and copy fancyBox to js/fancybox/ directory

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|FILENAME|size|size_desc|ext"]
[owner = "UserName"]
[max = number]

Set the parameter target=2 to use fancyBox.

6.1. Example

{{gallery table=1 target=2 title="local pictures"}}


-> Example for Testing

6.2. local usage of repository

symlink the gallery action from community action folder in wacko/action and wacko/action/template folder in repo

ln -s ../../community/action/gallery.php gallery.php
ln -s ../../../community/action/template/gallery.tpl gallery.tpl

7. Changelog

0.1 Intitial version
0.7 Updated to work with R.6.1 (PHP 8.0, Null coalescing assignment operator)

8. ToDo

  1. paging & lightbox
  2. add anchor to back button
  3. adding multiple instances in a page, causes loading of multiple instances

9. Links

  1. https://github.com/fancyapps/fancybox
  2. https://jquery.com/

9.1. Alternatives

Replacement with an MIT / Apache / BSD license so we can add it to the core.

  1. http://www.jacklmoore.com/colorbox/ [MIT license]
  2. https://brutaldesign.github.io/swipebox/ [MIT license]
  3. https://github.com/dimsemenov/Magnific-Popup [MIT license]
    1. https://www.smashingmagazine.c[...]responsive-lightbox/

Others

  1. https://github.com/sachinchoolur/lightGallery [GPL3]

Show Files (1 file)

Read comment (1 comment)