ckanext-gallery
A CKAN extension for a dataset gallery view.
Overview
Adds a gallery view for resources on a CKAN instance. Three plugins are included in this extension: the main plugin (gallery) and two view plugins for specific image/data types (gallery_image and gallery_iiif).
Based on blueimp Gallery.
Installation
Installing from PyPI
pip install ckanext-gallery
Installing from source
Clone the repository into the src folder:
cd $INSTALL_FOLDER/src
git clone https://github.com/NaturalHistoryMuseum/ckanext-gallery.git
Activate the virtual env:
. $INSTALL_FOLDER/bin/activate
Install via pip:
pip install $INSTALL_FOLDER/src/ckanext-gallery
Post-install setup
Add ‘gallery’ to the list of plugins in your config:
ckan.plugins = ... gallery
Install lessc globally:
npm install -g "less@~4.1"
Configuration
| Option |
Description |
Default |
| ckanext.gallery.records_per_page |
Number of images to display on a page |
32 |
| ckanext.gallery.image.resource_types |
Space-separated list of resource formats for basic image field type |
csv tsv |
| ckanext.gallery.iiif.resource_types |
Space-separated list of resource formats for IIIF image field type |
csv tsv |
Usage
To use as a view, no further setup is needed; the ‘Gallery’ type should be available for resources after installing the plugin.
Interfaces
The IGalleryImage interface allows plugins to override settings.
Templates
{% snippet 'gallery/snippets/gallery.html', images=g.images, resource_id=res.id %}
Testing
There is a Docker compose configuration available in this repository to make it easier to run tests.