diff --git a/Extend/Library/ORG/Util/Image.class.php b/Extend/Library/ORG/Util/Image.class.php index f342b23..7383118 100644 --- a/Extend/Library/ORG/Util/Image.class.php +++ b/Extend/Library/ORG/Util/Image.class.php @@ -275,17 +275,18 @@ static function thumb2($image, $thumbname, $type='', $maxWidth=200, $maxHeight=5 else $thumbImg = imagecreate($maxWidth, $maxHeight); + if ('gif' == $type || 'png' == $type) { + imagealphablending($thumbImg, false);//取消默认的混色模式 + imagesavealpha($thumbImg,true);//设定保存完整的 alpha 通道信息 + $background_color = imagecolorallocate($thumbImg, 0, 255, 0); // 指派一个绿色 + imagecolortransparent($thumbImg, $background_color); // 设置为透明色,若注释掉该行则输出绿色的图 + } + // 复制图片 if (function_exists("ImageCopyResampled")) imagecopyresampled($thumbImg, $srcImg, 0, 0, $srcX, $srcY, $maxWidth, $maxHeight, $cutWidth, $cutHeight); else imagecopyresized($thumbImg, $srcImg, 0, 0, $srcX, $srcY, $maxWidth, $maxHeight, $cutWidth, $cutHeight); - if ('gif' == $type || 'png' == $type) { - //imagealphablending($thumbImg, false);//取消默认的混色模式 - //imagesavealpha($thumbImg,true);//设定保存完整的 alpha 通道信息 - $background_color = imagecolorallocate($thumbImg, 0, 255, 0); // 指派一个绿色 - imagecolortransparent($thumbImg, $background_color); // 设置为透明色,若注释掉该行则输出绿色的图 - } // 对jpeg图形设置隔行扫描 if ('jpg' == $type || 'jpeg' == $type)