]> git.sesse.net Git - pr0n/blobdiff - perl/Sesse/pr0n/Common.pm
Extract the number only from the ISO value.
[pr0n] / perl / Sesse / pr0n / Common.pm
index 9708b7a116591feea37e5cb063ef543ad22b4179..e339fd3ab596026f33390cdefa97579ecce2a249 100644 (file)
@@ -371,7 +371,7 @@ sub ensure_cached {
        my ($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres, @otherres) = @_;
 
        my $fname = get_disk_location($r, $id);
-       unless (defined($xres) && ($xres < $dbheight || $yres < $dbwidth || !defined($dbwidth) || !defined($dbheight) || $xres == -1)) {
+       unless (defined($xres) && (!defined($dbwidth) || !defined($dbheight) || $xres < $dbheight || $yres < $dbwidth || $xres == -1)) {
                return ($fname, 0);
        }
 
@@ -557,12 +557,16 @@ sub make_infobox {
 
 #      Apache2::ServerUtil->server->log_error(join(':', keys %$info));
 
+       my $iso = undef;
        if (defined($info->{'NikonD1-ISOSetting'})) {
-               push @classic_fields, [ $info->{'NikonD1-ISOSetting'}->[1] . " ISO", 0 ];
-       } elsif (defined($info->{'ISOSetting'})) {
-               push @classic_fields, [ $info->{'ISOSetting'} . " ISO" ];
+               $iso = $info->{'NikonD1-ISOSetting'};
        } elsif (defined($info->{'ISO'})) {
-               push @classic_fields, [ $info->{'ISO'} . " ISO" ];
+               $iso = $info->{'ISO'};
+       } elsif (defined($info->{'ISOSetting'})) {
+               $iso = $info->{'ISOSetting'};
+       }
+       if (defined($iso) && $iso =~ /(\d+)/) {
+               push @classic_fields, [ $1 . " ISO", 0 ];
        }
 
        if (defined($info->{'ExposureBiasValue'}) && $info->{'ExposureBiasValue'} ne "0") {