寻找到文件类方法:\ThinkPHP\Library\Think\Image\Driver\Gd.class.php:
/**
* 保存图像
* @param string $imgname 图像保存名称
* @param string $type 图像类型
* @param integer $quality 图像质量
* @param boolean $interlace 是否对JPEG类型图像设置隔行扫描
*/
public function save($imgname, $type = null, $quality=80,$interlace = true){
if(empty($this->img)) E('没有可以被保存的图像资源');
//自动获取图像类型
if(is_null($type)){
$type = $this->info['type'];
} else {
$type = strtolower($type);
}
//保存图像
if('jpeg' == $type || 'jpg' == $type){
//JPEG图像设置隔行扫描
imageinterlace($this->img, $interlace);
imagejpeg($this->img, $imgname,$quality);
}elseif('gif' == $type && !empty($this->gif)){
$this->gif->save($imgname);
}else{
$fun = 'image'.$type;
$fun($this->img, $imgname);
}
}
修改成:
/**
* 保存图像
* @param string $imgname 图像保存名称
* @param string $type 图像类型
* @param integer $quality 图像质量
* @param boolean $interlace 是否对JPEG类型图像设置隔行扫描
*/
public function save($imgname, $type = null, $quality=80,$interlace = true){
if(empty($this->img)) E('没有可以被保存的图像资源');
//自动获取图像类型
if(is_null($type)){
$type = $this->info['type'];
} else {
$type = strtolower($type);
}
//保存图像
if('jpeg' == $type || 'jpg' == $type){
//JPEG图像设置隔行扫描
imageinterlace($this->img, $interlace);
imagejpeg($this->img, $imgname,$quality);
}elseif('gif' == $type && !empty($this->gif)){
$this->gif->save($imgname);
}elseif('png' == $type){
imagesavealpha($this->img, true);
}else{
$fun = 'image'.$type;
$fun($this->img, $imgname);
}
}
相信你的问题就解决啦!O0O