From 18921404e5454cdf202b7b4f70a2777f3e297998 Mon Sep 17 00:00:00 2001 From: Darkelarious Date: Mon, 25 Sep 2017 23:13:47 +0200 Subject: Web interface for MasterServer-Perl --- lib/MasterWebInterface/Util/Figures.pm | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 lib/MasterWebInterface/Util/Figures.pm (limited to 'lib/MasterWebInterface/Util/Figures.pm') diff --git a/lib/MasterWebInterface/Util/Figures.pm b/lib/MasterWebInterface/Util/Figures.pm new file mode 100755 index 0000000..a3f3e5f --- /dev/null +++ b/lib/MasterWebInterface/Util/Figures.pm @@ -0,0 +1,38 @@ +package MasterWebInterface::Util::Figures; +use strict; +use warnings; +use TUWF ':html'; +use Exporter 'import'; +use Image::Size; +our @EXPORT = qw| figure figurelink |; + +################################################################################ +# Load image in Yorhel's IV. +################################################################################ +sub figure { + my ($self, $d, $f, $s) = @_; + my $extra_css = (defined($s)) ? "style=\"$s\"" : ""; + my ($w, $h) = imgsize("$self->{img_path}/$d/$f"); + # make a link and show a thumbnail if exists, else photo itself + if (-e "$self->{img_path}/t/$f") { + lit "\"$f\"/ " + } + else{ + lit "\"$f\"/ "} +} + +################################################################################ +# Have a picture $f link to destination $dest -- wrapper function +################################################################################ +sub figurelink { + my ($self, $d, $f, $dest) = @_; + # make a link and show a thumbnail if exists, else photo itself + if (-e "$self->{img_path}/t/$f") { + lit "\"$f\"/ " + } + else{ + lit "\"$f\"/ "} +} + + +1; -- cgit v1.2.3