mason/dhandler (.contact): Report the number of subfolders and images.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 15 Jun 2023 16:29:58 +0000 (17:29 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Thu, 15 Jun 2023 16:30:28 +0000 (17:30 +0100)
mason/dhandler

index 94c39cc..44ab7ed 100755 (executable)
@@ -85,12 +85,14 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 
        my $size = "medthumb";
        my %tn;
+       my (%nd, %nf);
        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;
          DIR: for (;;) {
            if (defined $iii) {
              my $index = join_paths $p, $iii->name;
@@ -120,9 +122,13 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 <h2>Subfolders</h2>
 <div class="gallery <% $size %>">
 %   for my $d (@$dd) {
+%     my $count = "";
+%     $count .= "$nd{$d}/" if $nd{$d};
+%     $count .= "$nf{$d}" if $nf{$d};
   <& .thumbnail, target => $d->name, comment => $d->comment,
                 tn => $tn{$d}, size => $size,
-                caption => $m->interp->apply_escapes($d->name, "h") &>\
+                caption =>
+                  $m->interp->apply_escapes($d->name, "h") . " [$count]" &>\
 %   }
 </div>
 % }