mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
feature: RSS amended (read image from pipe, scaling options, line width)
git-svn-id: https://svn.fhem.de/fhem/trunk@4015 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6792903e91
commit
439f210717
@ -1,5 +1,8 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
|
||||
- 2013-xx-xx (SVN)
|
||||
- feature: RSS amended (read image from pipe, scaling options, line width)
|
||||
|
||||
- 2013-09-29 (5.5)
|
||||
- feature: new module 55_PIFACE.pm added (betateilchen)
|
||||
- feature: Calendar can read from file and limit number of calendar events
|
||||
|
@ -274,11 +274,29 @@ RSS_itemImg {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} elsif($srctype eq "data") {
|
||||
if($imgtype eq "gif") {
|
||||
$I= GD::Image->newFromGifData($arg);
|
||||
} elsif($imgtype eq "png") {
|
||||
$I= GD::Image->newFromPngData($arg);
|
||||
} elsif($imgtype eq "jpeg") {
|
||||
$I= GD::Image->newFromJpegData($arg);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
($x,$y)= RSS_xy($S,$x,$y);
|
||||
my ($width,$height)= $I->getBounds();
|
||||
if ($scale =~ s/([wh])([\d]*)/$2/) { # get the digit from width/hight to pixel entry
|
||||
#Debug "RSS scale $scale (1: $1 / 2: $2)contais px after Digit - width: $width / height: $height";
|
||||
if ($1 eq "w") {
|
||||
$scale=$scale/$width;
|
||||
} else {
|
||||
$scale=$scale/$height;
|
||||
}
|
||||
}
|
||||
my ($swidth,$sheight)= (int($scale*$width), int($scale*$height));
|
||||
#Debug "RSS placing $arg ($swidth x $sheight) at ($x,$y)";
|
||||
$S->copyResampled($I,$x,$y,0,0,$swidth,$sheight,$width,$height);
|
||||
@ -286,9 +304,10 @@ RSS_itemImg {
|
||||
|
||||
sub
|
||||
RSS_itemLine {
|
||||
my ($S,$x1,$y1,$x2,$y2,%params)= @_;
|
||||
my ($S,$x1,$y1,$x2,$y2,$th,%params)= @_;
|
||||
($x1,$y1)= RSS_xy($S,$x1,$y1);
|
||||
($x2,$y2)= RSS_xy($S,$x2,$y2);
|
||||
$S->setThickness($th);
|
||||
$S->line($x1,$y1,$x2,$y2,RSS_color($S,$params{rgb}));
|
||||
}
|
||||
|
||||
@ -334,8 +353,9 @@ RSS_evalLayout($$@) {
|
||||
#Debug "$name: ($x,$y) $txt";
|
||||
RSS_itemText($S,$x,$y,$txt,%params);
|
||||
} elsif($cmd eq "line") {
|
||||
($x1,$y1,$x2,$y2)= split("[ \t]+", $def, 4);
|
||||
RSS_itemLine($S,$x1,$y1,$x2,$y2,%params);
|
||||
($x1,$y1,$x2,$y2,$format)= split("[ \t]+", $def, 5);
|
||||
$format //= 1; # set format to 1 as default thickness for the line
|
||||
RSS_itemLine($S,$x1,$y1,$x2,$y2, $format,%params);
|
||||
} elsif($cmd eq "time") {
|
||||
($x,$y)= split("[ \t]+", $def, 2);
|
||||
RSS_itemTime($S,$x,$y,%params);
|
||||
@ -632,12 +652,13 @@ RSS_CGI(){
|
||||
<li>time <x> <y><br>Renders the current time in HH:MM format.</li><br>
|
||||
<li>seconds <x> <y> <format><br>Renders the curent seconds. Maybe usefull for a RSS Clock. With option colon a : </li><br>
|
||||
<li>date <x> <y><br>Renders the current date in DD:MM:YYY format.</li><br>
|
||||
<li>line <x1> <y1> <x2> <y2><br>Draws a line from position (<x1>, <y1>) to position (<x2>, <y2>).</li><br>
|
||||
<li>img <x> <y> <s> <imgtype> <srctype> <arg> <br>Renders a picture at the
|
||||
<li>line <x1> <y1> <x2> <y2> [<thickness>]<br>Draws a line from position (<x1>, <y1>) to position (<x2>, <y2>) with optional thickness (default=1).</li><br>
|
||||
<li>img <x> <y> <['w' or 'h']s> <imgtype> <srctype> <arg> <br>Renders a picture at the
|
||||
position (<x>, <y>). The <imgtype> is one of <code>gif</code>, <code>jpeg</code>, <code>png</code>.
|
||||
The picture is scaled by the factor <s> (a decimal value). If <srctype> is <code>file</code>, the picture
|
||||
The picture is scaled by the factor <s> (a decimal value). If 'w' or 'h' is in front of scale-value the value is used to set width or height to the value in pixel. If <srctype> is <code>file</code>, the picture
|
||||
is loaded from the filename <arg>, if <srctype> is <code>url</code>, the picture
|
||||
is loaded from the URL <arg>. You can use
|
||||
is loaded from the URL <arg>, if <srctype> is <code>data</code>, the picture
|
||||
is loaded from Data <arg>. You can use
|
||||
<code>{ <a href="#perl"><perl special></a> }</code> for <arg>. See below for example.
|
||||
Notice: do not load the image from URL that is served by fhem as it leads to a deadlock.<br></li>
|
||||
<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user