Photo Gallery Plugin

A gallery plugin for JPEG photos from digital cameras.

Description

This plugin renders galleries from photos attached to topics. Galleries render as a grid of square thumbnails. Thumbnails are created using the Epeg library ("insanely fast JPEG thumbnail scaling") via the Image::Epeg Perl module. Clicking on a thumbnail zooms the image to the original attached photo. Currently PhotoSwipe by Dmitry Semenov is used to display the photos. It allows zooming and browsing the image gallery with the keyboard, the mouse and finger swipes on touch devices. This plugin adds a slideshow functionality not currently present in the original PhotoSwipe gallery. The thumbnails expose a tools menu by hovering over their top right corner. Available tools include losslessly rotating the photo using exiftran, editing the attachment comment, correcting the attachment timestamp to the photo exposure date, moving the attachment to another topic, and deleting the attachment.

This plugin works only with JPEG images and it works best with photos from digital cameras that have EXIF data embedded. It needs a fairly recent browser to support various Javascript and image scaling and transition magic.

See VarPHOTOGALLERY on how to use it.

The plugin ships with a bulk attach script (tools/photogallerypluginattach.pl) with built-in help.

See Foswiki::Plugins::PhotoGalleryPlugin for developer details.


Screenshots

Here are a few screenshots of the plugin in action:

%IMAGE{ "screenshot0.jpg" width="621" height="370" type="frame" align="none" caption="example gallery with info tooltip, zoomed image, upload form" }% %IMAGE{ "screenshot1.jpg" width="346" height="173" type="frame" align="none" caption="grid of square thumbnails" }% %IMAGE{ "screenshot4.jpg" width="313" height="198" type="frame" align="none" caption="image zoomed and shown in PhotoSwipe gallery, caption composed from attachment comment and EXIF meta data" }% %IMAGE{ "screenshot2.jpg" width="283" height="127" type="frame" align="none" caption="action menu pops up when hovering the top right corner of the thumbnail" }% %IMAGE{ "screenshot3.jpg" width="264" height="144" type="frame" align="none" caption="edit attachment comment dialog" }%


Preferences

Plugin Configuration and Defaults

The following settings are available in the configure interface:

  • path to the exiftran utility ({Plugins}{PhotoGalleryPlugin}{ExifTranPath})
  • the default thumbnail quality factor ({Plugins}{PhotoGalleryPlugin}{QualityDefault})
  • the default time format to render timestamps ({Plugins}{PhotoGalleryPlugin}{DateFmtDefault})
  • the default caption format for thumbnails and photos ({Plugins}{PhotoGalleryPlugin}{CaptFmtDefault})
  • the default admin mode ({Plugins}{PhotoGalleryPlugin}{AdminDefault})
  • the default thumbnail size ({Plugins}{PhotoGalleryPlugin}{SizeDefault})

The plugin does not use any preference settings.

Skin Extension

This plugin comes with a skin extension that adds two options (checkboxes) to the upload form, namely

  • an option to activate lossless rotation of JPEG images based on EXIF camera orientation meta data, and
  • an option to set the attachment upload date to the photo exposure time (from EXIF).

The skin extension comes with two skin templates that add the options to the PatternSkin's and the TopicInteractionPlugin's upload form.


Installation

Plugin

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

This plugin needs the exiftran utility installed on the system in order to provide the photo rotation feature described above. In Linux distributions the package is typically called "exiftran" and can be installed through "package managers" or "software centres". Try the command sudo apt-get install exiftran on Debian and derivates.

The Image::Epeg Perl module might not be available as a system package. It can be downloaded from CPAN and be built and installed manually (see e.g. here).

Skin Extension

To activate the upload form options described above add (prepend) photogallery to the SKIN list in Main.SitePreferences. See Skins for details.

Cache

The plugin caches data (EXIF meta data, thumbnails) in the working/work_areas/PhotoSwipePlugin directory. It will keep the timestamps of the used files up-to-date. The plugin ships with a script to clean up the cache by removing old files from the cache directory. It is suggested to install a cronjob to run the script on a regular basis. Run tools/photogalleryplugincleanup.pl -h to see the built-in help for more details. Alternatively, standard system tools, such as "tmpreaper", can be used to remove old files. No harm is done removing them all from time to time.

Bulk Upload

The standard Foswiki file upload mechnism is not exactly suitable to upload many photos. There are a number of alternatives:

  • Use the bulk attach script shipped with this plugin (tools/photogallerypluginattach.pl). The script must be executed on the server where Foswiki is running. It can then attach any number of photos to a topic. The image files must reside on the server, too. Note that the script must be executed as the server Foswiki (or the web server) is running as.
  • The TopicInteractionPlugin replaces the standard upload form with a multi-file upload mechanism (plus some more attachment manipulation features). If you do not like its "interaction stuff" it adds to the view template you can disable that by removing templates/view.topicinteraction.tmpl.
  • A number of other plugins used to be available (UploadPlugin, BatchUploadPlugin, maybe more) but I think they no longer work in today's Foswiki.

Upgrading

If you have page caching enabled you may need to clear the page cache after upgrading this plugin. See PageCaching for details.


Dependencies

NameVersionDescription
JSON>=0.1Required for REST handler feedback (not sure which version is the minimal requirement)
Image::ExifTool>=0.1Required for extracting and displaying photo meta data (not sure which version is the minimal requirement)
File::Copy>=0.1Required for photo manipulation operations (not sure which version is the minimal requirement)
Error>=0.1Required for error handling (not sure which version is the minimal requirement)
POSIX>=0.1Required for file operations (not sure which version is the minimal requirement)
Digest::MD5>=0.1Required for caching (not sure which version is the minimal requirement)
Storable>=0.1Required for caching (not sure which version is the minimal requirement)
File::Touch>=0.1Required for caching (not sure which version is the minimal requirement)
Image::Epeg>=0.13Required for fast thumbnail generation
Foswiki::Plugins::JQueryPlugin>=6.32Required for everything
Foswiki::Contrib::FamFamFamContrib>=1.9Required for action menu items
Foswiki::Plugins>=2.1Required plugin interface


Change History

Date Version Comment
29 May 2016 v1.4 - minor cleanup (rmove duplicate function, fix dependency file)
16 May 2016 v1.3 - add possibility to automatically split galleries into individual days by injecting customisable headings
- minor documentation improvements
1 May 2016 v1.2 - add cache cleanup script
- improve bulk upload script
- force meta data and thumbnail cache update when attachment version changes
- fix plugin crash when all attachments are unreadable (file gone, but FILEATTACHMENT still there)
- fix display of timestamp admin menu entry
- allow saving empty comment
- improved various bits in the plugin code
21 Apr 2016 v1.1 - cleanup and improve docu
- fix setting EXIF exposure date on upload
- add bulk upload script
15 Apr 2016 v1.0 - initial released version

PackageForm edit

Author Philippe Kehl
Version 1.4
Release 29 May 2016
Description A gallery plugin for JPEG photos from digital cameras.
Repository https://github.com/phkehl/PhotoGalleryPlugin
Copyright © 2016 Philippe Kehl, https://oinkzwurgl.org
License GPL (GNU General Public License)
Home https://foswiki.org/Extensions/PhotoGalleryPlugin
Support https://foswiki.org/Support/PhotoGalleryPlugin
Topic attachments
I Attachment Action Size Date Who Comment
screenshot0.jpgjpg screenshot0.jpg manage 157 K 17 Apr 2016 - 16:32 UnknownUser plugin screenshot
screenshot1.jpgjpg screenshot1.jpg manage 44 K 25 Feb 2016 - 22:27 UnknownUser plugin screenshot
screenshot2.jpgjpg screenshot2.jpg manage 26 K 25 Feb 2016 - 22:27 UnknownUser plugin screenshot
screenshot3.jpgjpg screenshot3.jpg manage 25 K 25 Feb 2016 - 22:27 UnknownUser plugin screenshot
screenshot4.jpgjpg screenshot4.jpg manage 29 K 25 Feb 2016 - 22:27 UnknownUser plugin screenshot
Topic revision: r1 - 25 Feb 2016, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback