summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-11-02 17:20:10 +0100
committerYorhel <git@yorhel.nl>2010-11-02 17:23:55 +0100
commit54c84adc85ed31d4ab6593a593af4dbc8a4f3305 (patch)
tree240be2fd449829c530dfd0b1a2b83fad2bb4da24 /lib/VNDB
parent4d42eb7cddfbf578577295c407b08beb8161af1f (diff)
Handler::(Misc|VNPage): Added HTML width/height to screenshot thumbnails
And made sure the dimensions are truncated in VNDBUtil::imgsize(). Setting the width/height attributes makes sure that the browser can reserve space for the image when it hasn't been loaded yet, which prevents the overall page layout from changing while the images are loading. (which is annoying if your connection isn't all that fast)
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/Handler/Misc.pm4
-rw-r--r--lib/VNDB/Handler/VNPage.pm4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index de4bdd67..87839730 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -48,8 +48,10 @@ sub homepage {
my $scr = $self->dbScreenshotRandom;
p class => 'screenshots';
for (@$scr) {
+ my($w, $h) = imgsize($_->{width}, $_->{height}, @{$self->{scr_size}});
a href => "/v$_->{vid}", title => $_->{title};
- img src => sprintf("%s/st/%02d/%d.jpg", $self->{url_static}, $_->{scr}%100, $_->{scr}), alt => $_->{title};
+ img src => sprintf("%s/st/%02d/%d.jpg", $self->{url_static}, $_->{scr}%100, $_->{scr}),
+ alt => $_->{title}, width => $w, height => $h;
end;
}
end;
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index f47aa8c4..c3544e4a 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -465,10 +465,12 @@ sub _screenshots {
end;
div class => 'scr';
for (@scr) {
+ my($w, $h) = imgsize($_->{width}, $_->{height}, @{$self->{scr_size}});
a href => sprintf('%s/sf/%02d/%d.jpg', $self->{url_static}, $_->{id}%100, $_->{id}),
class => sprintf('scrlnk%s%s', $_->{nsfw} ? ' nsfw':'', $_->{nsfw}&&!$self->authInfo->{show_nsfw}?' hidden':''),
rel => "iv:$_->{width}x$_->{height}:scr";
- img src => sprintf('%s/st/%02d/%d.jpg', $self->{url_static}, $_->{id}%100, $_->{id}), alt => mt '_vnpage_scr_num', $_->{id};
+ img src => sprintf('%s/st/%02d/%d.jpg', $self->{url_static}, $_->{id}%100, $_->{id}),
+ width => $w, height => $h, alt => mt '_vnpage_scr_num', $_->{id};
end;
}
end;