From e9f8c99ed456dc006c02e2dbde1568b5bb04476b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 21 Jun 2023 11:15:12 +0100 Subject: [PATCH] mason/.perl-lib/TrivGal.pm: Simplify the image-type machinery. This was really only needed for the benefit of Imlib2, which needed to be told what kind of output image file to make. GraphicsMagick doesn't have this deficiency. The MIME type stuff was never used at all. --- mason/.perl-lib/TrivGal.pm | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/mason/.perl-lib/TrivGal.pm b/mason/.perl-lib/TrivGal.pm index f498894..2bd64ed 100644 --- a/mason/.perl-lib/TrivGal.pm +++ b/mason/.perl-lib/TrivGal.pm @@ -94,33 +94,6 @@ sub urldecode ($) { } ###-------------------------------------------------------------------------- -### Image types. - -our %TYPE; - -package TrivGal::ImageType { - sub new ($$) { - my ($cls, $ext) = @_; - return $TYPE{$ext} = bless { ext => $ext }, $cls; - } - sub ext ($) { - my ($me, @args) = @_; - return $me->{ext}; - } - sub mimetype ($@) { - my ($me, @args) = @_; - return TrivGal::read_or_set $me, $me->{mimetype}, @args; - } - sub imlibfmt ($@) { - my ($me, @args) = @_; - return TrivGal::read_or_set $me, $me->{imlibfmt}, @args; - } -} - -TrivGal::ImageType->new(".jpg")->mimetype("image/jpeg")->imlibfmt("jpeg"); -TrivGal::ImageType->new(".png")->mimetype("image/png")->imlibfmt("png"); - -###-------------------------------------------------------------------------- ### Configuration. export qw{$SCOPE $SUFFIX}; @@ -159,6 +132,9 @@ our %SIZE = (smallthumb => 96, vast => 5400, immense => 8100); +export qw{%TYPE}; +our %TYPE = map { $_ => 1 } qw{.jpg .png}; + export qw{init}; my $initp = 0; sub init () { -- 2.11.0