]> mj.ucw.cz Git - gallery.git/blob - example/default.cf
a43f20ce4eca8eae15c5b22ffcfa1c54a659e4ef
[gallery.git] / example / default.cf
1 # Generic configuration file for UCW::Gallery
2
3 use strict;
4 use warnings;
5 use utf8;
6
7 use UCW::Gallery;
8 use Cwd;
9
10 our $base_dir;
11 our $gallery;
12 our $static_dir;
13 our $lib_dir;
14
15 BEGIN {
16         my $current_dir = getcwd;
17         if (($base_dir, $gallery) = $current_dir =~ m{(.*)/lib/photos/(.*)}) {
18                 # We are called from the generated web tree
19                 $static_dir = "$base_dir/static";
20                 $lib_dir = "$base_dir/lib";
21         } elsif (($base_dir, $gallery) = $current_dir =~ m{(.*/web)/photos/(.*)}) {
22                 # We are called from the source tree
23                 $static_dir = "$base_dir/static";       # Expecting symlink to static
24                 $lib_dir = $base_dir;
25         } else {
26                 die "photos/default.cf: Please call me from the right directory\n";
27         }
28 }
29
30 use lib "$lib_dir/perl";
31
32 my $gal = UCW::Gallery->new();
33
34 $gal->set(
35         OrigDir => '/home/mj/photos',
36         PhotoDir => "$static_dir/gallery/photo/$gallery",
37         CacheDir => "$static_dir/gallery/cache/$gallery",
38         CacheExif => 1,
39
40         PhotoUrlPrefix => 'photo/',             # Rewritten by mod_rewrite later
41         ThumbUrlPrefix => 'thumb/',
42         ThemeUrlPrefix => '/gal/',
43
44         ParentURL => '/photos/',
45         WebHeadExtras => "<link rel=stylesheet href='/mj.css' type='text/css' media=all>\n",
46         WebBotExtras => sub ($) {
47                 my ($self) = @_;
48                 return "" if $self->showing_image;
49                 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>";
50                 return <<AMEN ;
51 <div class=gal-bottom><p class=gal-sep><hr>
52 <form action='.' method=POST>
53 $ziplink
54 </form></div>
55 AMEN
56         },
57 );
58
59 return $gal;