diff options
| author | Antonio Gallo <tonicucoz@gmail.com> | 2013-10-14 16:06:56 +0000 | 
|---|---|---|
| committer | Antonio Gallo <tonicucoz@gmail.com> | 2013-10-14 16:06:56 +0000 | 
| commit | a93461b231fb94f3a6a9df09a30557732201ddcc (patch) | |
| tree | f278951ee7746da2a618ec57043c57fafe779c1d /h-source/Library/Image | |
| parent | 6fa0219202ce4ccc5c4592e66031bb0f7f8be2b0 (diff) | |
added new EasyGiant Library
Diffstat (limited to 'h-source/Library/Image')
| -rw-r--r-- | h-source/Library/Image/Gd/Thumbnail.php | 19 | 
1 files changed, 16 insertions, 3 deletions
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  | 
