X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=gal2%2Fgal-scan;h=39dd6b0b831f9f6b22e02e0e19919ac3267a9985;hb=bfa0d113c413c2431f72405623d79cbc7b0b40f2;hp=c1b70d09f843b178154a55dbef6094f436372f2a;hpb=929e3ca5d5af812fe382abe5bd88ab306a3b496a;p=gallery.git diff --git a/gal2/gal-scan b/gal2/gal-scan index c1b70d0..39dd6b0 100755 --- a/gal2/gal-scan +++ b/gal2/gal-scan @@ -29,7 +29,7 @@ if (@ARGV) { my @p = (); while (my $e = readdir D) { my $f = File::Spec->canonpath(File::Spec->catfile($in, $e)); - if ($f =~ m{\.jpe?g$}i) { + if ($f =~ m{\.(jpe?g|png)$}i) { push @p, $f; } } @@ -47,12 +47,17 @@ if (@ARGV) { } 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"; @@ -74,7 +79,7 @@ foreach my $f (@files) { $o = "."; } push @images, { - file => $f, + file => $rel_name, id => $id, orientation => $o, xfrm => $UCW::Gallery::CF{'ScanDefaultTransform'},