2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

contrib/InfoPanel: fixed image resize

git-svn-id: https://svn.fhem.de/fhem/trunk@7835 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2015-02-02 19:10:32 +00:00
parent 49a9ec1008
commit bf74714b7b

View File

@ -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 = "<!-- w: $width h: $height nw: $newWidth nh: $newHeight t: $mimetype -->\n";
$output = "<!-- s: $scale w: $width h: $height t: $mimetype -->\n";
$output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"".$width."px\" height=\"".$height."px\" \nxlink:href=\"$data\" />\n";
$output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"${width}px\" height=\"${height}px\" \nxlink:href=\"$data\" />\n";
return $output;
}