Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Gallery configuration

Olivier Paroz edited this page Mar 13, 2016 · 9 revisions

It's possible to configure a Gallery album via a simple text file named gallery.cnf which contains parameters structured using the Yaml markup language.

Features

The following features are currently implemented:

General

  • Enabling native SVG support, letting browsers render SVG files directly
  • Enabling access to external shares which have been added via the files_external app

Albums

  • Adding a link to a file containing a description
  • Typing a simple copyright statement directly in the configuration file
  • Adding a link to a file containing a copyright statement
  • Defining a sort type and order
  • Defining the colour of the background
  • Defining if sub-albums will inherit the configuration

Slideshow

  • Showing a button which lets you pick which background, between black and white, should be used for the picture you are currently viewing in the slideshow

Set up

File

The file has to be named gallery.cnf

gallery.cnf is not a file with is used globally and which requires administrative privileges, it's a file which can be placed by users in various locations in their folders hierarchy.

To enable features, it has to be placed in the user's top folder, also called root folder, symbolised in the Web GUI by the home icon and it will end up being placed in data/<user>/files/.

To configure an album, the file will be placed in the album itself.

Note: You need to refresh the browser after changing your configuration if you want to see the changes in the Files app

Format

UTF-8, without BOM. A file created from within the web GUI works.

Structure

It's advised to add a comment in the file, so that people stumbling upon that file know what it's for. Comments start with #.

Spacing is created using 2 spaces. Do not use tabs

Take a look at the format documentation if you're getting error messages: http://symfony.com/doc/current/components/yaml/yaml_format.html

---
# Gallery configuration file
features:
  external_shares: yes
  native_svg: yes
  background_colour_toggle: yes
design:
  background: "#ff9f00"
  inherit: yes
information:
  description: This is an **album description** which is only shown if there is no `description_link`
  description_link: readme.md
  copyright: Copyright 2003-2015 [interfaSys sàrl](http://www.interfasys.ch), Switzerland
  copyright_link: copyright.md
  inherit: yes
sorting:
  type: date
  order: des
  inherit: yes

Supported variables

Global features

Used to configure the app. Only supported if gallery.cnf is placed in the top folder (home in the GUI)

  • external_shares: set it to yes in your root configuration file if you want to be able to load images stored on external locations, when using the files_external app
  • native_svg: set it to yes in your root configuration file if you want to be able to see SVG images rendered by the browser. This may represent a security risk if you can't fully trust your SVG files
  • background_colour_toggle: set it to yes in your root configuration file if you want to have an additional button in the slideshow, enabling you to toggle the colour of the background of the transparent images you're viewing between black and white

Warning: External shares are 20-50 times slower than local shares. Be prepared to wait a long time before being able to see all the images contained in a shared album

Album configuration

Each album can be individually configured using the following configuration sections. It's possible to use the inherit parameter to make sure all sub-albums are configured the same way.

Design

  • background: lets you define the colour of the background of the photowall using the RGB hexadecimal representation of that colour. Per example: "#ffa033". Important: you must use quotes around the value or it will be ignored. It is strongly recommended to use a custom theme, with a CSS loading spinner if you intend to use this feature. You can use this colour wheel to find a colour you like
  • inherit: set it to yes if you want sub-folders to inherit this part of the configuration

Album presentation

  • description: a markdown formatted string which will be displayed in the info box. It can spread over multiple lines using the Yaml markers
  • description_link: a markdown file located within the album and which will be parsed and displayed in the info box instead of the description
  • copyright: a markdown formatted string. You can add links to external resources if you need to.
  • copyright_link: any file (i.e. copyright.html), in the album itself, which will be downloaded when the user clicks on the link
  • inherit: set it to yes if you want sub-folders to inherit this part of the configuration

See this page for the markdown syntax

Note: Do not add links to your copyright string if you intend on adding a copyright link

Sorting

  • sorting: date or name. date only works for files
  • sort_order: asc or des
  • inherit: set it to yes if you want sub-folders to inherit this part of the configuration

Possible future extensions

  • Different sorting parameters for albums

Notes

  • in case only the sort type variable has been set, the default sort order will be used
  • in case only the sort order variable has been found, the sort configuration will be ignored and the script will keep looking for a valid configuration in upper folders
  • To enable a feature such as native SVG in a public share, you need to create in that folder a configuration file containing that feature
  • If you share a folder publicly, don't forget to add all the files you link to (description.md or copyright.md per example) inside the shared folder as the user won't have access to files stored in the parent folder
  • Since people can download a whole folder as an archive, it's usually best to include all files within a shared folder as opposed to adding text directly in the configuration file

Examples

Sorting only

Applies to the current folder only

---
# Gallery configuration file
sorting:
  type: date
  order: asc

Short description and link to copyright document

Applies to the current folder and all of its sub-folders

This also shows you the syntax you can use to spread a description over multiple lines

---
# Gallery configuration file
information:
  description: | 
    # La Maison Bleue, Winter '16
    This is our Winter 2016 collection shot in **Kyoto**
    Visit out [website](http://www.secretdesigner.ninja) for more information
  copyright: Copyright 2015 La Maison Bleue, France
  copyright_link: copyright_2015_lmb.html
  inherit: yes

Load images from external clouds

Features can only be defined in the top folder (home in the GUI)

You can add standard configuration items to the same configuration file

---
# Gallery configuration file
features:
  external_shares: yes
...

Enabling native SVG

Special features can only be defined in the top folder (home in the GUI)

You can add standard configuration items to the same configuration file

---
# Gallery configuration file
features:
  native_svg: yes
...
Clone this wiki locally