An image gallery.
- Automatic thumbnail creation
- Thumbnail rotation + regeneration
- Multiple galleries
- Picture lightbox
- Directory navigation
- Customizable theme
git clone <this repository> --recursive
cd style/d120 && npm install
git pull <this repository>
cd style/d120
git submodule update --init
npm install
The entire instance of picview is configured by some global variables in
a config.php
file in the root directory. To set one of the following options,
simply create a variable with that name in the configuration file.
- Type:
string
- Required:
true
- Options: Any existing and writable path on the system
- Description: The path where comment data is stored.
- Type:
string
- Required:
true
- Example:
copyright.txt
- Description: Naming convention for a file from which the text is rendered on every image in that folder when it exists.
- Type:
string
- Required:
true
- Example:
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
- Description: A TTF-File that can be used to render unicode code points on the image. Used whenever text is written into the images.
- Type:
int
- Required:
true
- Description: The intended length of the shorter edge of the preview images.
- Type:
string
- Required: Only if there is a gallery with the
ldap
authentication method. - Description: Any valid URL of an LDAP server host. See ldap_connect.
- Type:
string
- Required:
true
- Options: Any existing file absolute or relative to the
index.php
script. - Description: The template for the picture comment/lightbox action.
- Type:
string
- Required:
true
- Options: Any existing file absolute or relative to the
index.php
script. - Description: The template for the directory view action.
- Type:
string
- Required:
true
- Options: Any existing and writable path on the system
- Description: The path where preview images are stored / cached.
- Type:
int
- Required:
true
- Description: The amount of thumbnails to show on a single page for the current folder
- Type:
int
- Required:
true
- Description: The intended length of the shorter edge of the thumbnails.
PicView allows for multiple galleries on a single instance. Each gallery is
assigned a separate galleryId
, which corresponds to the first element in the
PATH_INFO
for any PicView URL.
To configure the galleries, add an array named $galleries
to config.php
.
Within that array, add a configuration array for each gallery. The key used for
this inner array is the galleryId
. The following subsections will explain the
different configuration options that are available.
- Type:
string
- Required:
false
- Default: The gallery id
- Description: Sets a title for this gallery. Used in breadcrumbs.
- Type:
string
- Required:
true
- Options:
'ldap'
,'password'
or''
- Description: The method used to restrict access to certain people.
The LDAP method will allow any user from the configured LDAP,
the password method will allow any username and password configured for this gallery (
password
). The default method is to allow any user agent to access the pictures.
- Type:
Array(string => string)
- Required: Only if using authentication method
password
- Description: Array where the keys are valid users and the values are valid passwords
- Type:
string
- Required:
true
- Description: The (absolute) path to the (read-only) images folder of this gallery
PicView provides its interface by a set of actions which may be applied to any given path within the gallery. The available options are:
t
: Deliver a thumbnail of the image (thumb_size
)m
: Deliver a downscaled version of the image (medium_size
)i
: Deliver the original imagec
: Deliver a HTML lightbox with commentss
: Process a comment POST requestr
: Rotate the thumbnail and downscaled preview images clockwised
: Delete and thus regenerate the preview imagesp
: Show a gallery of the images within the directoryj
: Deliver a JSON representation of the current resourceh
: Deliver a HAL+JSON representation of the current resource
The URLs for these actions always have the form /picview/index.php/{gallery}/{action}/{resource}
Template files are plain HTML files which may contain tags that will be replaced
by dynamic content. Tags correspond to entries in the context array passed to
make_page
.
The general page template is used for the p
action to display the pictures
and subfolders of a resource path. The available tags are:
%base_uri%
: Prefix for absolute path to the root folder (can be blank for root)%breadcrumb%
: A sequence of<li><a href="...
tags, listing the directories from the root of the gallery to the current resource.%content%
: The galleries for the current folder and a preview of the galleries of the first-level subfolders.%navigation%
: A sequence of<li><a href="...
tags, listing an[up]
and all subfolders of the current resource.%pagetitle%
:picView: {resource}
The lightbox template is used for the c
action to display the preview and comments
for any given image, as well as allowing to navigate to the adjacent images. The
available tags are:
%actions%
: A sequence of<li><a href="...
tags, for actions that can be applied to the current resource.%base_uri%
: Prefix for absolute path to the root folder (can be blank for root)%breadcrumb%
: A sequence of<li><a href="...
tags, listing the directories from the root of the gallery to the current resource.%comments%
: A sequence of blockquotes and a form for displaying and writing comments.%content%
: The carousel of the current image and the links to the adjancent images.%navigation%
: A sequence of<li><a href="...
tags, listing an[up]
and all subfolders of the current resource.%pagetitle%
:picView: {resource}
The following is an example configuration of picView:
<?php
$template_file = 'style/picview.tpl';
$lightbox_file = 'style/lightbox.tpl';
$copyright_file = 'copyright.txt';
$font_file = '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf';
$thumbs_path = '/var/www/html/thumbs';
$comments_path = '/var/www/html/comments';
$thumbs_per_page = 30;
$thumb_size = 120;
$medium_size = 600;
$galleries = [
"picview" => [
"pictures_path" => "/var/www/html/pictures",
"auth_required" => false,
"title" => "pictures"
],
"wp-content" => [
"pictures_path" => "/var/www/html/wp-content",
"auth_required" => "password",
"password" => [
"user" => "somepassword"
]
]
];
?>