- my $e = new Image::EXIF($f);
- my $i = $e->get_all_info();
- if ($e->error) { print "EXIF error: ", $e->error, "\n"; }
- else {
- # print STDERR Dumper($i), "\n";
- my $o = $i->{'image'}->{'Image Orientation'} || "Top, Left-Hand";
- if ($o eq "Top, Left-Hand") { $o = "."; }
- elsif ($o eq "Right-Hand, Top") { $o = "r"; }
- elsif ($o eq "Left-Hand, Bottom") { $o = "l"; }
- elsif ($o eq "Bottom, Right-Hand") { $o = "d"; }
- else {
- print "Unrecognized orientation: $o\n";
- $o = ".";
- }
- push @images, {
- file => $rel_name,
- id => $id,
- orientation => $o,
- xfrm => $gal->get('ScanDefaultTransform'),
- title => '',
- };
- print "ori=$o\n";
+ if (!defined $src->{id}) {
+ my $sha = Digest::SHA->new(1);
+ $sha->addfile($path) or die "Cannot hash $path\n";
+ $src->{id} = substr($sha->hexdigest, 0, 16);