From 700799a041f52703208110cfa85d9c2ff57c87b6 Mon Sep 17 00:00:00 2001
From: betateilchen <>
Date: Mon, 2 Feb 2015 13:23:49 +0000
Subject: [PATCH] contrib/InfoPanel: fixed plot resize
git-svn-id: https://svn.fhem.de/fhem/trunk@7833 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/contrib/InfoPanel/55_InfoPanel.pm | 35 ++++++++++++++++++++------
1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/fhem/contrib/InfoPanel/55_InfoPanel.pm b/fhem/contrib/InfoPanel/55_InfoPanel.pm
index e6417bc8a..bb6b94f08 100644
--- a/fhem/contrib/InfoPanel/55_InfoPanel.pm
+++ b/fhem/contrib/InfoPanel/55_InfoPanel.pm
@@ -305,7 +305,7 @@ sub btIP_itemImg {
}
($width,$height,$mimetype,$data) = _btIP_imgData($data,$scale);
- $output = "\n";
+ $output = "\n";
$output .= "\n";
return $output;
}
@@ -317,6 +317,12 @@ sub _btIP_imgData {
my $height = $info->{height};
($width,$height)= _btIP_imgRescale($width,$height,$scale);
my $mimetype = $info->{file_media_type};
+
+ if($FW_userAgent =~ m/Trident/ && $mimetype =~ m/svg/) {
+ $arg =~ s/width=".*"//g;
+ $arg =~ s/height=".*"//g;
+ }
+
my $data = "data:$mimetype;base64,".encode_base64($arg);
return ($width,$height,$mimetype,$data);
}
@@ -331,6 +337,15 @@ sub _btIP_imgRescale {
return ($width,$height);
}
+sub _btIP_svgRescale {
+ my ($width,$height,$scale) = @_;
+ if ($scale =~ s/([whWH])([\d]*)/$2/) {
+ $scale = (uc($1) eq "W") ? $scale/$width : $scale/$height;
+ }
+ return $scale;
+}
+
+
sub btIP_itemLine {
my ($id,$x1,$y1,$x2,$y2,$th,%params)= @_;
$id = ($id eq '-') ? createUniqueId() : $id;
@@ -352,8 +367,8 @@ sub btIP_itemPlot {
}
}
-# ($width,$height) = split(",", AttrVal($plotName[0],"plotsize","800,160"));
-# ($width,$height) = _btIP_imgRescale($width,$height,$scale) unless $scale eq '1';
+ ($width,$height) = split(",", AttrVal($plotName[0],"plotsize","800,160"));
+ ($width,$height) = _btIP_imgRescale($width,$height,$scale) unless $scale eq '1';
if($inline eq "1") {
#
@@ -370,11 +385,17 @@ sub btIP_itemPlot {
($mimetype, $svgdata) = SVG_showLog("unused");
$svgdata =~ s/<\/svg>/<\/svg>/;
- ($width,$height,$mimetype,$svgdata) = _btIP_imgData($svgdata,$scale);
- $output = "\n";
- $output .= "\n";
+ ($width,$height,$mimetype,$svgdata) = _btIP_imgData($svgdata,1);
+ $scale = _btIP_svgRescale($width,$height,$scale);
+
+ $output = "\n";
+# $output .= "\n";
+ $output .= "\n".
+ "\n\n".
+ "\n";
} else {
#
# embed link to plot