--- /dev/null
+Options -Indexes
+
+RewriteEngine On
+RewriteBase /photos/
+RewriteRule ^([0-9][0-9][0-9][0-9]/.*)/thumb/(.*) /static/gallery/cache/$1/$2 [L]
+RewriteRule ^([0-9][0-9][0-9][0-9]/.*)/photo/(.*) /static/gallery/photo/$1/$2 [L]
+RewriteRule ^([0-9][0-9][0-9][0-9]/[^/]+)$ $1/ [R,L]
+RewriteRule ^([0-9][0-9][0-9][0-9]/[^/]+)(/.*) gallery.cgi?dir=$1 [L,QSA]
--- /dev/null
+This is an example how to build a web gallery using UCW::Gallery.
+
+It requires UCW::CGI from LibUCW (see http://www.ucw.cz/libucw/)
+and lots of tweaking for your site.
+
+You can see a gallery very similar to this example in action
+at http://mj.ucw.cz/photos/.
--- /dev/null
+# Generic configuration file for UCW::Gallery
+
+use strict;
+use warnings;
+use utf8;
+
+use UCW::Gallery;
+use Cwd;
+
+our $base_dir;
+our $gallery;
+our $static_dir;
+our $lib_dir;
+
+BEGIN {
+ my $current_dir = getcwd;
+ if (($base_dir, $gallery) = $current_dir =~ m{(.*)/lib/photos/(.*)}) {
+ # We are called from the generated web tree
+ $static_dir = "$base_dir/static";
+ $lib_dir = "$base_dir/lib";
+ } elsif (($base_dir, $gallery) = $current_dir =~ m{(.*/web)/photos/(.*)}) {
+ # We are called from the source tree
+ $static_dir = "$base_dir/static"; # Expecting symlink to static
+ $lib_dir = $base_dir;
+ } else {
+ die "photos/default.cf: Please call me from the right directory\n";
+ }
+}
+
+use lib "$lib_dir/perl";
+
+my $gal = UCW::Gallery->new();
+
+$gal->set(
+ OrigDir => '/home/mj/photos',
+ PhotoDir => "$static_dir/gallery/photo/$gallery",
+ CacheDir => "$static_dir/gallery/cache/$gallery",
+ CacheExif => 1,
+
+ PhotoUrlPrefix => 'photo/', # Rewritten by mod_rewrite later
+ ThumbUrlPrefix => 'thumb/',
+ ThemeUrlPrefix => '/gal/',
+
+ ParentURL => '/photos/',
+ WebHeadExtras => "<link rel=stylesheet href='/mj.css' type='text/css' media=all>\n",
+ WebBotExtras => sub ($) {
+ my ($self) = @_;
+ return "" if $self->showing_image;
+ my $ziplink = "<p>The whole gallery can be also <button class=gal-zip type=submit name=a value=zip>downloaded as a ZIP archive.</button>";
+ return <<AMEN ;
+<div class=gal-bottom><p class=gal-sep><hr>
+<form action='.' method=POST>
+$ziplink
+</form></div>
+AMEN
+ },
+);
+
+return $gal;
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use lib $ENV{'DOCUMENT_ROOT'} . "/../lib/gal/lib";
+use lib $ENV{'DOCUMENT_ROOT'} . "/../lib/perl";
+use UCW::CGI;
+use UCW::CGI::ErrorHandler;
+use UCW::Gallery;
+use UCW::Gallery::Web::HighSlide;
+
+my $dir;
+UCW::CGI::parse_args({
+ dir => { var => \$dir, check => '^\w+(/([A-Za-z0-9][A-Za-z0-9.-]*))*$' },
+});
+
+my $path = $ENV{'DOCUMENT_ROOT'} . "/../lib/photos/$dir";
+if ($dir ne "" && -f "$path/gallery.cf") {
+ chdir $path or die;
+ my $gal = UCW::Gallery->load_config();
+ UCW::Gallery::Web::HighSlide->run($gal);
+} else {
+ print STDERR "Gallery not found: $path\n";
+ UCW::CGI::http_error("404 Gallery Not Found");
+}