w width after scaling
h height after scaling
title photo title
+ fmt photo format (png/jpg; defaults to jpg)
The rest is present in cache.meta only:
return ($tw, $th);
}
+sub photo_name($$$) {
+ my ($self, $photo_meta, $id) = @_;
+ return $id . '.' . ($photo_meta->{fmt} // 'jpg');
+}
+
1;
my $w = $m->{w};
my $h = $m->{h};
print "<h1>$t</h1>\n" if $t ne "";
- my $img = $self->get('PhotoUrlPrefix') . $id . '.jpg';
+ my $img = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_name($m, $id);
print "<p class=large><img src='$img' width=$w height=$h alt='$t'>\n";
$self->html_bot;
my $meta = $self->{meta};
for my $idx (1..$self->{num_photos}) {
my $id = $meta->{sequence}->[$idx-1];
+ my $m = $meta->{photo}->{$id};
my $click_url;
if ($self->get('WebImageSubpages')) {
$click_url = "?i=$idx";
} else {
- $click_url = $self->get('PhotoUrlPrefix') . "$id.jpg";
+ $click_url = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_name($m, $id);
}
$self->show_thumb($meta, $id, $click_url);
}
# Highslide requires title either for all images, or for none
my $tit = " title=\"$annot\"";
my $aid = $self->{hs_thumb_counter}++ ? "" : " id=thumb1";
- my $photo_url = $self->get('PhotoUrlPrefix') . "$photo_id.jpg";
+ my $photo_url = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_name($m, $photo_id);
print "<li><a$aid href='$click_url' class=highslide onclick='return hs.expand(this, { src: \"$photo_url\" })'>";
print "<img src='$thumb' width=$tw height=$th alt='Photo'$tit></a>\n";
}
print "\t$id: ";
my $p = new Image::Magick;
- my $photo = File::Spec->catfile($photo_dir, "$id.jpg");
+ my $photo = File::Spec->catfile($photo_dir, $gal->photo_name($m, $id));
my $e;
$e = $p->Read($photo) and die "Error reading $photo: $e";
$p->Resize(width=>$w, height=>$h);
}
- my $photo = File::Spec->catfile($photo_dir, $id . ".jpg");
+ my $photo = File::Spec->catfile($photo_dir, $gal->photo_meta($m, $id));
my $tmp = "$photo.new";
$e = $p->Write($tmp) and die "Unable to write $tmp: $e";
rename $tmp, $photo or die "Cannot rename $tmp to $photo: $!\n";