mason/.perl-lib/TrivGal.pm (%SIZE): Modify and extend the available sizes.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 21 Jun 2023 09:33:42 +0000 (10:33 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 21 Jun 2023 09:33:42 +0000 (10:33 +0100)
I want to support fetching main view images scaled adaptively for the
window size.  This involves having many more image sizes.  I considered
abolishing the `%SIZE' list, but realized that this wouldn't work
because `Image::scale' needs to pass back a size name in its lazy-
thumbnailing query string.

Instead, just add lots of new sizes.  The scale factor is about 3/2 in
each case.  Making the factor more-or-less uniform involved changing a
couple of existing sizes: `bigthumb' shrunk a little from 228 to 216;
`view' used to be 1200, but is replaced by `medium', which is
significantly smaller at 1080.  I know that `small' and `embed' are
already used externally, and have preserved these names and their
values (though the values already fit well into the sequence, so this
wasn't a hardship).

I'd have preferred to have more mall words and fewer big words in the
list, but I was constrained by the existing value of `small'.  It seems
that there are just more words for being very big than being very small
anyway.

mason/.perl-lib/TrivGal.pm
mason/dhandler

index 3346c1a..4e5527b 100644 (file)
@@ -148,10 +148,16 @@ our $SRCURL = "https://git.distorted.org.uk/~mdw/tgal/";
 export qw{%SIZE};
 our %SIZE = (smallthumb => 96,
             medthumb => 144,
-            bigthumb => 228,
+            bigthumb => 216,
+            tiny => 320,
             small => 480,
             embed => 720,
-            view => 1200);
+            medium => 1080,
+            big => 1600,
+            large => 2400,
+            huge => 3600,
+            vast => 5400,
+            immense => 8100);
 
 export qw{init};
 my $initp = 0;
index 49e5f84..611567a 100755 (executable)
@@ -231,7 +231,7 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
          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("view"); }
+           { $fi = $i; $vw = $img->scale("medium"); }
        }
        defined $fi or die "image not found in its folder?";
        my $this = $ff->[$fi];