+# 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;