NAME
Nginx::Module::Gallery - Gallery perl module for nginx. Like simple file index but thumbnail replace default icon for image.
SYNOPSIS
Example of nginx http section:
http{
...
# Path to Gallery.pm
perl_modules /usr/share/perl5/;
perl_require Nginx/Module/Gallery.pm;
}
Example of nginx server section:
server {
listen 80;
server_name gallery.localhost;
location / {
perl Nginx::Module::Gallery::handler;
# Path to image files
root /usr/share/images;
}
}
DESCRIPTION
This module not for production servers! But for single user usage. Gallery don`t use nginx event machine, so one nginx worker per connect (typically 8) used for slow create icons!
All icons cached on first request. Next show will be more fast.
VARIABLES
ICON_MAX_DIMENSION
Max icon dimension. In pixels. All thumbnails well be resized to this dimension.
ICON_MAX_SIZE
Max icon size. In bytes. Default 128Kb.
ICON_COMPRESSION_LEVEL
Icon comression level 0-9 for use in PNG
ICON_QUALITY_LEVEL
Icon quality level 0-9 for use in videos
CACHE_PATH
Path for thumbnails cache
CACHE_MODE
Mode for created thumbnails
TEMPLATE_PATH
Templates path
ICONS_PATH
Path for MIME and other icons
VIDEO_THUMBNAILER
Video thumbnailer command for sprintf. First %s - onput file path, second %s - output file path.
IMAGE_THUMBNAILER
Image thumbnailer command for sprintf. First %s - onput file path, second %s - output file path.
IMAGE_PARAMS
Command for get image params like width, height, etc.
FUNCTIONS
handler $r
Main loop handler
PRIVATE FUNCTIONS
show_image
Send image to client
show_favicon
Send favicon
show_index
Send directory index to client
_get_md5_image $path
Return unque MD5 hex string for image file by it`s $path
_escape_path $path
Return escaped $path
get_icon_form_cache $path
Check icon for image by $path in cache and return it if exists
save_icon_in_cache
Save $icon in cache for image by $path
make_icon $path
Get $path of image and make icon for it
_template $name
Retrun template my $name
_icon_common $name
Return common icon by $name
_icon_mime $path
Return mime icon for file by $path
as_human_size(NUM)
converts big numbers to small 1024 = 1K, 1024**2 == 1M, etc
AUTHORS
Copyright (C) 2012 Dmitry E. Oboukhov <unera@debian.org>,
Copyright (C) 2012 Roman V. Nikolaev <rshadow@rambler.ru>
LICENSE
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.