X-Git-Url: https://git.distorted.org.uk/~mdw/tgal/blobdiff_plain/fd972456d42c0d1e5031e4d12ae2ae74384e1582..7cd805d11b686c973574dd5cab7b1cb8f907f26d:/mason/dhandler diff --git a/mason/dhandler b/mason/dhandler index 4676769..0c834b9 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -222,16 +222,26 @@ Failed to find ‘<% $path |h %>’. my $urldir = join_paths $SCRIPTURL, $dir; my ($dd, $ff, $ii) = listdir $realdir; my @thumbsz = qw{smallthumb medthumb bigthumb}; + my @imgsz = sort { $SIZE{$a} <=> $SIZE{$b} } keys %SIZE; + my ($wd, $ht, $max); my %tn; - my $vw; + my %vw; my $fi = undef; FILE: for (my $i = 0; $i < @$ff; $i++) { my $f = $ff->[$i]; my $img = TrivGal::Image->new(join_paths $dir, $f->name); for my $sz (@thumbsz) { $tn{$f->name}{$sz} = $img->scale($sz); } - if ($ff->[$i]->name eq "$base$ext") - { $fi = $i; $vw = $img->scale("medium"); } + if ($ff->[$i]->name eq "$base$ext") { + $fi = $i; + ($wd, $ht) = ($img->wd, $img->ht); + $max = $img->sz; + SIZE: for my $sc (@imgsz) { + my $sz = $SIZE{$sc}; + last SIZE if $max < $sz; + $vw{$sc} = $img->scale($sc); + } + } } defined $fi or die "image not found in its folder?"; my $this = $ff->[$fi]; @@ -270,7 +280,19 @@ Failed to find ‘<% $path |h %>’. % } - + +% my ($hoff, $voff) = (60, 480); +% SIZE: for (my $i = 0; $i < @imgsz; $i++) { +% my $scale = $imgsz[$i]; +% last SIZE unless exists $vw{$scale}; +% my $scsz = $SIZE{$scale}; +% my $f = $scsz/$max; +% my ($thiswd, $thisht) = map int, ($f*$wd + $hoff, $f*$ht + $voff); + +% } + "> + % if ($link{next}) {