]> mj.ucw.cz Git - gallery.git/blobdiff - gal2/UCW/Gallery.pm
Gallery2: Removed auto-generated comment at the top of gallery.list
[gallery.git] / gal2 / UCW / Gallery.pm
index f13889d2d032f936dde83e04ac89ca51a8a54b1f..c8bdc68a5fd52f45e46ae682889fc552714084cf 100644 (file)
@@ -20,30 +20,35 @@ BEGIN {
 }
 
 our %CF;
-our $th;
 
-BEGIN {
-       $CF{'Title'} = 'An Unnamed Gallery',
-       $CF{'HeadExtras'} = "",
-       $CF{'TopExtras'} = "",
-       $CF{'BotExtras'} = "",
-       $CF{'ParentURL'} = '../',
-       $CF{'BackURL'} = "",
-       $CF{'FwdURL'} = "",
-       $CF{'ImageSubpages'} = 1,
-       $CF{'AllowArchives'} = 1,
-       $CF{'PhotoUrlPrefix'} = "",
-       $CF{'ThumbUrlPrefix'} = "",
-       $CF{'MetaDataDir'} = '.',
-       $CF{'PhotoDir'} = '.',
-
-       $CF{'ScanDefaultTransform'} = 'n';
-       $CF{'OrigDir'} = '.';
-       $CF{'PhotoDir'} = 'photo';
-       $CF{'CacheDir'} = "cache",
-       $CF{'PhotoMaxWidth'} = 1024,
-       $CF{'PhotoMaxHeight'} = 1024,
-}
+BEGIN { %CF = (
+       # Directories
+       OrigDir => '.',                 # Original images
+       PhotoDir => 'photo',            # Scaled-down photos for web
+       CacheDir => 'cache',            # Cache with meta-data and thumbnails
+       ThemeDir => 'gal',              # Themes
+
+       # URL prefixes
+       PhotoUrlPrefix => 'photo/',
+       ThumbUrlPrefix => 'thumb/',
+       ThemeUrlPrefix => 'gal/',
+
+       # Processing machinery settings
+       ScanDefaultTransform => 's',
+       PhotoMaxWidth => 1024,
+       PhotoMaxHeight => 1024,
+       ThumbFormats => {},             # Set up by themes
+
+       # HTML output settings
+       Title => 'An Unnamed Gallery',
+       HeadExtras => "",
+       TopExtras => "",
+       BotExtras => "",
+       ParentURL => '../',
+       BackURL => "",
+       FwdURL => "",
+       ImageSubpages => 1,
+); }
 
 sub LoadConfig() {
        my $cfg = "./gallery.cf";
@@ -63,16 +68,21 @@ sub SetOptions(@) {
                my $v = shift @_;
                $CF{$o} = $v;
                if ($o eq "Theme") {
-                       require $CF{"GalDir"} . "/$v/theme.pm";
-                       Gallery::Theme::Init($CF{"GalURL"} . "/$v");
+                       require $CF{'ThemeDir'} . "/$v/theme.pm";
+                       UCW::Gallery::Theme::Init($CF{'ThemeUrlPrefix'} . $v);
                }
        }
 }
 
+sub RequireThumbnails($$) {
+       my ($w, $h) = @_;
+       my $fmt = "${w}x${h}";
+       $CF{'ThumbFormats'}->{$fmt} = 1;
+}
+
 sub WriteList($$) {
        my ($file, $images) = @_;
        open LIST, '>', "$file.new" or die "Cannot create $file.new: $!\n";
-       print LIST "# Image\tID\tRotate\tXform\tTitle\n";
        for my $i (@$images) {
                print LIST join("\t",
                        $i->{file},