aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Image
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Library/Image')
-rw-r--r--h-source/Library/Image/Gd/Thumbnail.php19
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