From a93461b231fb94f3a6a9df09a30557732201ddcc Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 14 Oct 2013 16:06:56 +0000 Subject: added new EasyGiant Library --- h-source/Library/Image/Gd/Thumbnail.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'h-source/Library/Image/Gd') diff --git a/h-source/Library/Image/Gd/Thumbnail.php b/h-source/Library/Image/Gd/Thumbnail.php index 22e501e..1fd7796 100644 --- a/h-source/Library/Image/Gd/Thumbnail.php +++ b/h-source/Library/Image/Gd/Thumbnail.php @@ -75,7 +75,8 @@ class Image_Gd_Thumbnail if (file_exists($imagePath)) { - $ext = strtolower(end(explode('.', $imagePath))); + $extArray = explode('.', $imagePath); + $ext = strtolower(end($extArray)); if (strcmp($ext,'jpg') === 0 or strcmp($ext,'jpeg') === 0) { $img = @imagecreatefromjpeg($imagePath); @@ -112,7 +113,7 @@ class Image_Gd_Thumbnail } if ($scale < 1) { - + $xSrc = 0; $ySrc = 0; @@ -166,6 +167,11 @@ class Image_Gd_Thumbnail //temp image $tmpImg = imagecreatetruecolor($newWidth, $newHeight); + if(strcmp($type,'png') === 0 or strcmp($type,'gif') === 0){ + imagealphablending($tmpImg, false); + imagesavealpha($tmpImg, true); + } + if ($this->params['resample'] === 'yes') { //copy and resample @@ -185,7 +191,13 @@ class Image_Gd_Thumbnail $img = call_user_func($this->params['function'],$img); } - + else + { + if(strcmp($type,'png') === 0 or strcmp($type,'gif') === 0){ + imagealphablending($img, false); + imagesavealpha($img, true); + } + } } if (!$img) @@ -195,6 +207,7 @@ class Image_Gd_Thumbnail $img = imagecreate($imgWidth, $imgHeight); imagecolorallocate($img,200,200,200); + } //print the image -- cgit v1.2.3