From: Mark Wooding Date: Wed, 21 Jun 2023 09:51:34 +0000 (+0100) Subject: mason/dhandler (.contact): Determine the `count' strings in advance. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/tgal/commitdiff_plain/f6ac176798628842d70f993c03b4f4978bccbef1 mason/dhandler (.contact): Determine the `count' strings in advance. Rather than saving the raw statistics and determining the presentation later, just work out the presentation early. We're going to have multiple sizes of thumbnails in contact pages soon, and determining the presentation for each thumbnail size would be pointless. --- diff --git a/mason/dhandler b/mason/dhandler index 0c834b9..78f0f95 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -85,14 +85,19 @@ Failed to find ‘<% $path |h %>’. my $size = "medthumb"; my %tn; - my (%nd, %nf); + my %count; for my $f (@$ff) { $tn{$f} = TrivGal::Image->new($path . $f->name)->scale($size); } for my $d (@$dd) { my $p = join_paths $path, $d->name; my ($ddd, $fff, $iii); ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p; - $nd{$d} = @$ddd; $nf{$d} = @$fff; + + my $count = ""; + $count .= scalar(@$ddd) . "/" if @$ddd; + $count .= scalar(@$fff) if @$fff; + $count{$d} = $count; + DIR: for (;;) { if (defined $iii) { my $index = join_paths $p, $iii->name; @@ -125,14 +130,11 @@ Failed to find ‘<% $path |h %>’. % if (@$dd) {

Subfolders

% }