2 # (c) 2003--2012 Martin Mares <mj@ucw.cz>
10 # Standard Perl module stuff
12 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
15 @EXPORT = qw(&SetOptions);
24 $CF{"Title"} = "An Unnamed Gallery",
25 $CF{"HeadExtras"} = "",
26 $CF{"TopExtras"} = "",
27 $CF{"BotExtras"} = "",
28 $CF{"ParentURL"} = "../",
31 $CF{"ImageSubpages"} = 1,
32 $CF{"AllowArchives"} = 1,
33 $CF{"PhotoUrlPrefix"} = "",
34 $CF{"ThumbUrlPrefix"} = "",
35 $CF{"MetaDataDir"} = ".",
36 $CF{"PhotoDir"} = ".",
38 $CF{'ScanDefaultTransform'} = 'n';
40 $CF{'PhotoDir'} = 'photo';
41 $CF{"CacheDir"} = "cache",
45 my $cfg = "./gallery.cf";
46 unless (defined do $cfg) {
48 die "Error parsing $cfg: $@";
50 die "Cannot load $cfg: $!\n";
52 die "Cannot load $cfg, check that it returns true\n";
58 while (my $o = shift @_) {
62 require $CF{"GalDir"} . "/$v/theme.pm";
63 Gallery::Theme::Init($CF{"GalURL"} . "/$v");
69 my ($file, $images) = @_;
70 open LIST, '>', "$file.new" or die "Cannot create $file.new: $!\n";
71 print LIST "# Image\tID\tRotate\tXform\tTitle\n";
72 for my $i (@$images) {
78 ($i->{title} eq '' ? '-' : $i->{title}),
82 rename "$file.new", $file or die "Cannot rename $file.new to $file: $!\n";
88 open LIST, '<', $file or return;
94 ($i->{file}, $i->{id}, $i->{orientation}, $i->{xfrm}, $i->{title}) = split /\t/;
95 if ($i->{title} eq '-') { $i->{title} = ""; }