pstaender / silverstripe-photogallerypage
Adds a page type to manage multiple images including description and other various options
Installs: 314
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Type:silverstripe-vendormodule
Requires
This package is auto-updated.
Last update: 2024-10-29 10:54:14 UTC
README
Adds a page type to manage multiple images including description and other various options
The following SiteTree page type will be added:
GalleryPage
/GalleryPageController
GalleryPageHolder
GalleryPicture
Requirements
- SilverStripe 4+ (use v0.6.1 for SilverStripe 3.x)
Installation
$ composer require pstaender/silverstripe-photogallerypage
Don't forget to run a dev/build?flush=all
after installing.
Methods and Behaviour
All Pictures will be available through SortedPictures
, with +
for ascending (default) and -
for descending. All Pictures are also available as URL. Let's assume the URL of your GalleryPage is http://localhost/photos
and (an arbitary) image has the URLSegment example-picture
, it will be available as http://localhost/photos/example-picture
. This behaviour can be be switched on/off with picturesAccessibleViaURL
in your config.
Usage in Template
Your Layout/GalleryPage.ss
could be for instance:
<article class="gallery"> <h1>$Title</h1> <% with CurrentPicture %> <h2>Selected Picture</h2> $Image.ScaleHeight(200) <br /> <span class="previousPicture"> <% with Previous %> <a href="$Link">« $Image.ScaleHeight(100)</a> <% end_with %> </span> <span class="nextPicture"> <% with Next %> <a href="$Link">$Image.ScaleHeight(100) » </a> <% end_with %> </span> <% end_with %> <br /> <h3>All Pictures</h3> <% loop SortedPictures %> <a href="$Link" class="$LinkingMode"> $ImagePreview <% if LinkingMode == 'current' %>selected<% end_if %> </a> <% end_loop %> </article>
Configuration
See in _config/photogallerypage.yml
what possible configuration attributes are available for you to overwrite.
Copyright and License
This project is under GNU General Public License v2
Icons by Freepik (http://www.flaticon.com/packs/web-design-2)