require Sesse::pr0n::Config_local;
};
- $VERSION = "v2.05";
+ $VERSION = "v2.10";
@ISA = qw(Exporter);
@EXPORT = qw(&error &dberror);
%EXPORT_TAGS = qw();
return ($width, $height);
}
-sub print_link {
- my ($r, $title, $baseurl, $param, $defparam) = @_;
- my $str = "<a href=\"$baseurl";
+sub get_query_string {
+ my ($param, $defparam) = @_;
my $first = 1;
+ my $str = "";
while (my ($key, $value) = each %$param) {
next unless defined($value);
$str .= "$key=$value";
$first = 0;
}
-
- $str .= "\">$title</a>";
+ return $str;
+}
+
+sub print_link {
+ my ($r, $title, $baseurl, $param, $defparam) = @_;
+ my $str = "<a href=\"$baseurl" . get_query_string($param, $defparam) . "\">$title</a>";
$r->print($str);
}
# update the last_picture cache as well (this should of course be done
# via a trigger, but this is less complicated :-) )
- $dbh->do('UPDATE events SET last_picture=GREATEST(last_picture, ?) FROM images WHERE event=events.id) WHERE id=(SELECT event FROM images WHERE id=?)',
+ $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) WHERE event=(SELECT event FROM images WHERE id=?)',
undef, $datetime, $id)
or die "Couldn't update last_picture in SQL: $!";
}
# NEF files aren't autodetected
$fname = "NEF:$fname" if ($filename =~ /\.nef$/i);
- $r->log->warn("Generating $fname for $filename");
my $err = $magick->Read($fname);
if ($err) {
push @lines, "$1-$2-$3 $4:$5";
}
- push @lines, $info->{'Model'} if (defined($info->{'Model'}));
+ if (defined($info->{'Model'})) {
+ my $model = $info->{'Model'};
+ $model =~ s/^\s+//;
+ $model =~ s/\s+$//;
+ push @lines, $model;
+ }
# classic fields
if (defined($info->{'FocalLength'}) && $info->{'FocalLength'} =~ /^(\d+)(?:\.\d+)?(?:mm)?$/) {
}
if (defined($info->{'Flash'})) {
- if ($info->{'Flash'} =~ /did not fire/ || $info->{'Flash'} =~ /No Flash/) {
+ if ($info->{'Flash'} =~ /did not fire/i ||
+ $info->{'Flash'} =~ /no flash/i ||
+ $info->{'Flash'} =~ /not fired/i ||
+ $info->{'Flash'} =~ /Off/) {
push @lines, "No flash";
- } elsif ($info->{'Flash'} =~ /fired/) {
+ } elsif ($info->{'Flash'} =~ /fired/i ||
+ $info->{'Flash'} =~ /On/) {
push @lines, "Flash";
} else {
push @lines, $info->{'Flash'};