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{'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{'CacheDir'} = "cache",
}
sub LoadConfig() {
}
UCW::Gallery::LoadConfig;
+my $orig_prefix = $UCW::Gallery::CF{'OrigDir'};
+$orig_prefix =~ m{/$} or $orig_prefix .= '/';
print "Scanning photos\n";
my @images = ();
foreach my $f (@files) {
- my ($fv, $fd, $ff) = File::Spec->splitpath($f);
- print "\t$ff: ";
+ my $rel_name = $f;
+ if (substr($rel_name, 0, length $orig_prefix) eq $orig_prefix) {
+ $rel_name = substr($rel_name, length $orig_prefix);
+ }
+ print "\t$rel_name: ";
my $sha = Digest::SHA->new(1);
$sha->addfile($f) or die "Cannot hash $f\n";
$o = ".";
}
push @images, {
- file => $f,
+ file => $rel_name,
id => $id,
orientation => $o,
xfrm => $UCW::Gallery::CF{'ScanDefaultTransform'},