From 3de03c7ad617d0f03c062a82a5bb5eb070f0f7cd Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 21 Jun 2023 10:33:42 +0100 Subject: [PATCH] mason/.perl-lib/TrivGal.pm (%SIZE): Modify and extend the available sizes. 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 | 10 ++++++++-- mason/dhandler | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mason/.perl-lib/TrivGal.pm b/mason/.perl-lib/TrivGal.pm index 3346c1a..4e5527b 100644 --- a/mason/.perl-lib/TrivGal.pm +++ b/mason/.perl-lib/TrivGal.pm @@ -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; diff --git a/mason/dhandler b/mason/dhandler index 49e5f84..611567a 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -231,7 +231,7 @@ Failed to find ‘<% $path |h %>’. 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]; -- 2.11.0