silverstripe-gallery 

silverstripe-gallery Git Source Tree

Root/README.md

1Silverstripe Gallery
2====================
3
4A new page type (_GalleryPage_) that provides everything needed to
5manage a photo gallery.
6
7You can do bulk uploads and reorder the images by dragging and dropping
8their thumbnails in a dedicated tab (_Gallery_) inside the CMS. The same
9image can be shared among multiple galleries.
10
11Usage
12-----
13
14You can write your own templates and support the JavaScript library of
15your choice. Out of the box the [Fotorama](http://fotorama.io/) library
16is used. You can embed the default gallery block in your pages by
17including `ContentGallery.ss`, e.g.:
18
19 <%-- This is a typical Page.ss --%>
20 <h1>$Title</h1>
21 <div class="gallery">
22 <% include ContentGallery.ss %>
23 </div>
24 <div class="content">
25 $Content
26 </div>
27
28Keep in mind the default templates only use the `Height` and
29`ThumbnailHeight` settings: they *must* be set to a value greater than 0
30or an error will be generated. By default they should be set by the CMS
31to 400 and 64 respectively.
32
33Alternatively, the `GalleryPage.ss` layout template is provided. It
34renders a full (standard) page, though it works out of the box only with
35[silverstrap](http://dev.entidi.com/p/silverstrap/) because it relies on
36some convention adopted by that theme.
37
38Configuration
39-------------
40
41This module adds some field to the _Settings_ tab. This will allow to
42customize some aspect of the gallery at run time on a per page basis,
43e.g. the height of the thumbnail strip, the height of the image slide
44and a flag to show or hide the captions.
45
46The fallback values can be customized too by leveraging the SilverStripe
47[configuration API](http://docs.silverstripe.org/en/developer_guides/configuration/).
48Just create your own YAML file in `mysite/_config`, e.g.:
49
50 ---
51 Name: DefaultSettings
52 After:
53 - 'gallery/*'
54 ---
55 GalleryPage:
56 defaults:
57 Captions: false
58 Height: 480
59 ThumbnailWidth: 0
60 ThumbnailHeight: 80
61
62The above settings will be applied to _every_ instance of the
63`GalleryPage` class.
64
65Author
66------
67
68Although the project originally started as a fork of
69[silverstripe-gallery](https://github.com/i-lateral/silverstripe-gallery)
70by [i-lateral](http://www.i-lateral.com/), the actual code has been
71rewrote almost from scratch by [ntd](mailto:ntd@entidi.it) and, apart
72the name, practically everything else has changed.
73
74The project [home page](http://silverstripe.entidi.com/) is shared by
75other [SilverStripe](http://www.silverstripe.org/) modules and themes.
76
77To check out the code, report issues or propose enhancements, go to the
78[dedicated tracker](http://dev.entidi.com/p/silverstripe-gallery).
79Alternatively, you can do the same things by leveraging the official
80[github repository](https://github.com/ntd/silverstripe-gallery).
81
82Installation
83------------
84
85The gallery module is implemented as an extension of
86[silverstripe-carousel](https://github.com/ntd/silverstripe-carousel),
87so you *must* install it first. This in turn will install the
88[sortablefile](https://github.com/bummzack/sortablefile) module that
89provides the drag and drop reordering feature.
90
91To install silverstripe-gallery itself you should proceed as usual:
92drop the directory tree in your SilverStripe root and do a
93`/dev/build/`. You will gain the new `GalleryPage` type in the CMS.
94
95If you use [composer](https://getcomposer.org/), the dependencies will
96be pulled-in automatically, so you could just run the following command:
97
98 composer require entidi/silverstripe-gallery dev-master

Archive Download this file