use strict;
use warnings;
-use lib '/home/mj/web/gal2';
+use FindBin;
+use lib $FindBin::Bin;
use UCW::Gallery qw(%CF);
use Image::Magick;
print "Creating cache directory: $cache_dir\n";
File::Path::mkpath($cache_dir) or die "Unable to create $cache_dir: $!\n";
-for my $t (@{$CF{'ThumbSizes'}}) {
- my ($tw, $th) = @$t;
- my $thumb_fmt = $tw . 'x' . $th;
+for my $thumb_fmt (keys %{$CF{'ThumbFormats'}}) {
+ my ($tw, $th) = ($thumb_fmt =~ m{^(\d+)x(\d+)$}) or die "Cannot parse thumbnail format $thumb_fmt\n";
print "Generating $thumb_fmt thumbnails\n";
my $thumb_meta = {};
$meta->{thumb}->{$thumb_fmt} = $thumb_meta;