From 1ed2d426cb563f505e6616e29f4c364dc2291c0a Mon Sep 17 00:00:00 2001 From: Chouchen Date: Mon, 29 Nov 2010 15:38:44 +0000 Subject: [PATCH] Correction du bug de rotation ! --- trunk/svgtoimage.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/trunk/svgtoimage.php b/trunk/svgtoimage.php index 60cd553..b5bc7e4 100644 --- a/trunk/svgtoimage.php +++ b/trunk/svgtoimage.php @@ -267,9 +267,9 @@ class SVGTOIMAGE{ //rotating the image if needed if($r != 0){ if($this->_debug){ - if($newImage = imagerotate($newImage, - floatval($r), -1)) + if($newImage = imagerotate($newImage, - floatval($r), -1)){ $this->_log->message('Rotating image'); - else + }else $this->_log->error('Rotating image'); }else{ $newImage = imagerotate($newImage, - floatval($r), -1); @@ -277,9 +277,10 @@ class SVGTOIMAGE{ $blue = imagecolorallocate($newImage, $this->transparentColor[0], $this->transparentColor[1],$this->transparentColor[2]); imagecolortransparent($newImage, $blue); } - - imagecopy($this->_image,$newImage,$x,$y,0,0, $width , $height); - //imagecopy($this->_image,$newImage,$x,$y,0,0,imagesx($newImage) , imagesy($newImage)); + $newWidth = imagesx($newImage); + $newHeight = imagesy($newImage); + //imagecopy($this->_image,$newImage,$x,$y,0,0, $width , $height); + imagecopy($this->_image,$newImage,($newWidth == $width) ? $x : $x-($newWidth-$width)/2,($newHeight == $height) ? $y : $y-($newHeight-$height)/2,0,0,imagesx($newImage) , imagesy($newImage)); } /*