X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=gal2%2FUCW%2FGallery.pm;h=c8bdc68a5fd52f45e46ae682889fc552714084cf;hb=007f7a52da1cfc87f33de07fc873d0fac46558b4;hp=f13889d2d032f936dde83e04ac89ca51a8a54b1f;hpb=bfa0d113c413c2431f72405623d79cbc7b0b40f2;p=gallery.git diff --git a/gal2/UCW/Gallery.pm b/gal2/UCW/Gallery.pm index f13889d..c8bdc68 100644 --- a/gal2/UCW/Gallery.pm +++ b/gal2/UCW/Gallery.pm @@ -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},