diff --git a/fhem/CHANGED b/fhem/CHANGED index 9f910b3cd..e30f04006 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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 diff --git a/fhem/FHEM/02_RSS.pm b/fhem/FHEM/02_RSS.pm index 9848e3828..99d53394b 100644 --- a/fhem/FHEM/02_RSS.pm +++ b/fhem/FHEM/02_RSS.pm @@ -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(){
gif
, jpeg
, png
.
- The picture is scaled by the factor <s> (a decimal value). If <srctype> is file
, 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 file
, the picture
is loaded from the filename <arg>, if <srctype> is url
, the picture
- is loaded from the URL <arg>. You can use
+ is loaded from the URL <arg>, if <srctype> is data
, the picture
+ is loaded from Data <arg>. You can use
{ <perl special> }
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.