From efe7855776c41e4bacb97ef5038c3b5f6f62b67d Mon Sep 17 00:00:00 2001 From: chicpro Date: Tue, 3 Mar 2015 16:45:02 +0900 Subject: [PATCH] =?UTF-8?q?gif=20=EC=8D=B8=EB=84=A4=EC=9D=BC=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=95=8C=20=EB=B0=9C=EC=83=9D=ED=95=A0=20=EC=88=98?= =?UTF-8?q?=20=EC=9E=88=EB=8A=94=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/thumbnail.lib.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/thumbnail.lib.php b/lib/thumbnail.lib.php index b9a5c4abf..15ad429fc 100644 --- a/lib/thumbnail.lib.php +++ b/lib/thumbnail.lib.php @@ -333,11 +333,14 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h if($size[2] == 3) { imagealphablending($dst, false); imagesavealpha($dst, true); - } else if($size[2] == 1 && $src_transparency != -1) { - $transparent_color = imagecolorsforindex($src, $src_transparency); - $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); - imagefill($dst, 0, 0, $current_transparent); - imagecolortransparent($dst, $current_transparent); + } else if($size[2] == 1) { + $palletsize = imagecolorstotal($src); + if($src_transparency >= 0 && $src_transparency < $palletsize) { + $transparent_color = imagecolorsforindex($src, $src_transparency); + $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); + imagefill($dst, 0, 0, $current_transparent); + imagecolortransparent($dst, $current_transparent); + } } } else { $dst = imagecreatetruecolor($dst_w, $dst_h); @@ -367,7 +370,8 @@ function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_h imagealphablending($dst, false); imagesavealpha($dst, true); } else if($size[2] == 1) { - if($src_transparency != -1) { + $palletsize = imagecolorstotal($src); + if($src_transparency >= 0 && $src_transparency < $palletsize) { $transparent_color = imagecolorsforindex($src, $src_transparency); $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); imagefill($dst, 0, 0, $current_transparent);