From 9601c4bb6178c613e096ac17d581790f25d5ec60 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 9 Jun 2023 22:12:00 +0100 Subject: [PATCH] mason/dhandler: Add a `scale' parameter to images. Just ensures that a cached thumbnail of the requested size exists and redirects to it. Useful for references from other pages. --- mason/dhandler | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mason/dhandler b/mason/dhandler index aca88bb..ef7044c 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -146,6 +146,9 @@ Failed to find ‘<% $path |h %>’. my ($dir, $base, $ext) = split_path $path; my $real = join_paths $IMGROOT, $path; my $img = TrivGal::Image->new($path); + + if (defined $scale) { $m->redirect($img->scale($scale)); } + my $url = join_paths $IMGURL, $path; my $realdir = join_paths $IMGROOT, $dir; my $urldir = join_paths $SCRIPTURL, $dir; @@ -215,6 +218,7 @@ Failed to find ‘<% $path |h %>’. % <%args> $path + $scale => undef % -- 2.11.0