mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
preserve aspect ratio of background for 02_RSS.pm
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1420 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
705162b1ee
commit
11a3025264
@ -311,6 +311,8 @@ RSS_returnJPEG($) {
|
||||
$defs{$name}{fhem}{counter}= 1;
|
||||
}
|
||||
|
||||
# true color
|
||||
GD::Image->trueColor(1);
|
||||
|
||||
#
|
||||
# create the image
|
||||
@ -353,7 +355,16 @@ RSS_returnJPEG($) {
|
||||
my $bgfile= $bgdir . "/" . $bgfiles[$bgnr];
|
||||
my $bg= newFromJpeg GD::Image($bgfile);
|
||||
my ($bgwidth,$bgheight)= $bg->getBounds();
|
||||
$S->copyResized($bg,0,0,0,0,$width,$height,$bgwidth,$bgheight);
|
||||
my ($w,$h);
|
||||
my ($u,$v)= ($bgwidth/$width, $bgheight/$height);
|
||||
if($u>$v) {
|
||||
$w= $width;
|
||||
$h= $bgheight/$u;
|
||||
} else {
|
||||
$h= $height;
|
||||
$w= $bgwidth/$v;
|
||||
}
|
||||
$S->copyResized($bg,($width-$w)/2,($height-$h)/2,0,0,$w,$h,$bgwidth,$bgheight);
|
||||
}
|
||||
SKIPBG:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user