From bf74714b7b7d96423f5099ecdc18306592f88929 Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Mon, 2 Feb 2015 19:10:32 +0000 Subject: [PATCH] contrib/InfoPanel: fixed image resize git-svn-id: https://svn.fhem.de/fhem/trunk@7835 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/InfoPanel/55_InfoPanel.pm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fhem/contrib/InfoPanel/55_InfoPanel.pm b/fhem/contrib/InfoPanel/55_InfoPanel.pm index 79691a88c..2ac191bdd 100644 --- a/fhem/contrib/InfoPanel/55_InfoPanel.pm +++ b/fhem/contrib/InfoPanel/55_InfoPanel.pm @@ -304,9 +304,23 @@ sub btIP_itemImg { return ""; } - ($width,$height,$mimetype,$data) = _btIP_imgData($data,$scale); + ($width,$height,$mimetype,undef) = _btIP_imgData($data,1); + if($mimetype eq 'image/svg+xml') { + if($data !~ m/viewBox/) { + $data =~ s/width=/viewBox="0 0 $width $height"\n\twidth=/; + } + ($width,$height) = _btIP_imgRescale($width,$height,$scale); + $data =~ s/width=".*"/width="$width"/; + $data =~ s/height=".*"/height="$height"/; + $scale = 1; + (undef,undef,undef,$data) = _btIP_imgData($data,$scale); + } else { + ($width,$height,$mimetype,$data) = _btIP_imgData($data,$scale); + } + +# $output = "\n"; $output = "\n"; - $output .= "\n"; + $output .= "\n"; return $output; }