return ($tw, $th);
}
-sub photo_name($$$) {
+sub photo_file_name($$$) {
my ($self, $photo_meta, $id) = @_;
return $id . '.' . ($photo_meta->{fmt} // 'jpg');
}
+sub photo_name($$$) {
+ my ($self, $photo_meta, $id) = @_;
+ return File::Spec->catfile($self->get('PhotoDir'), $self->photo_file_name($photo_meta, $id));
+}
+
+
1;
my $w = $m->{w};
my $h = $m->{h};
print "<h1>$t</h1>\n" if $t ne "";
- my $img = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_name($m, $id);
+ my $img = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_file_name($m, $id);
print "<p class=large><img src='$img' width=$w height=$h alt='$t'>\n";
$self->html_bot;
if ($self->get('WebImageSubpages')) {
$click_url = "?i=$idx";
} else {
- $click_url = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_name($m, $id);
+ $click_url = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_file_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') . $self->{gal}->photo_name($m, $photo_id);
+ my $photo_url = $self->get('PhotoUrlPrefix') . $self->{gal}->photo_file_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 "Reading gallery.list\n";
my $orig_list = $gal->read_list('gallery.list') or die "Cannot read gallery.list: $!\n";
-my $photo_dir = $gal->get('PhotoDir');
my $photo_meta = $gal->photo_meta_name;
print "Reading meta-data from $photo_meta\n";
-f $photo_meta or die "Cannot load $photo_meta\n";
print "\t$id: ";
my $p = new Image::Magick;
- my $photo = File::Spec->catfile($photo_dir, $gal->photo_name($m, $id));
+ my $photo = $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, $gal->photo_meta($m, $id));
+ my $photo = $gal->photo_name($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";