]> mj.ucw.cz Git - gallery.git/blobdiff - gal/UCW/Gallery/Web/Plain.pm
Gallery2: Front-end attachment reform
[gallery.git] / gal / UCW / Gallery / Web / Plain.pm
index 885095b541e455689fdb0e592220eb1bd6aa2163..f7d213cb8443696a2a7140c693713476696797d3 100644 (file)
@@ -16,8 +16,6 @@ my $navw = 48;
 my $navh = 48;
 my $box_w = 130;
 my $box_h = 110;
-my $thumb_w = 114;
-my $thumb_h = 94;
 
 sub theme_dir($) {
        my ($self) = @_;
@@ -48,7 +46,8 @@ sub show_thumb($) {
        my $theme = $self->theme_dir;
        my $m = $meta->{photo}->{$photo_id};
        my $annot = UCW::CGI::html_escape($m->{title});
-       my $tf = $self->{thumb_fmt};
+       my $tf = $self->get('ThumbFormats')->[0];
+       my ($thumb_w, $thumb_h) = $self->{gal}->thumb_fmt_to_size($tf);
        my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
        my $tw = $tm->{w};
        my $th = $tm->{h};
@@ -61,10 +60,10 @@ sub show_thumb($) {
        print "</div></div>\n\n";
 }
 
-sub attach($$) {
+sub run($$) {
        my ($class, $gal) = @_;
        my $self = $class->SUPER::attach($gal);
-       $self->{thumb_fmt} = $gal->require_thumbnails($thumb_w, $thumb_h);
+       $self->dispatch();
        return $self;
 }