tp3.2使用thumb方法生成多张缩略图$upload = new \Think\Upload();// 实例化上传类<br>
$upload->maxSize = 3145728 ;// 设置附件上传大小<br>
$upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型<br>
$upload->rootPath = "./Public/Admin/Uploads/"; // 设置附件上传目录// 上传文件<br>
$upload ->autoSub = true;<br>
$upload ->subName = array('date','Ymd');<br>
//设置上传文件规则<br>
$upload->saveRule = 'uniqid';<br>
$info = $upload->uploadOne($_FILES['photo']);<br>
if(!$info) {<br>
// 上传错误提示错误信息<br>
$this->error($upload->getError());<br>
}else {<br>
// 上传成功 获取上传文件信息<br>
$img = $info['savepath'] . $info['savename'];<br>
$image = new \Think\Image();<br>
$BinImg = $upload->rootPath . "$img"; // 获得原图绝对路径<br>
$image->open($BinImg); // 打开原图<br>
// 添加水印<br>
// $image ->water($upload->rootPath."logo.png")-> save($upload ->rootPath.$img);<br>
// 生成一张<br>
// $image ->thumb(278,206,2); // 设置宽高和缩略类型<br>
<br>
// 设置缩略图宽、高、前缀<br>
$thumb = array(<br>
1 => array('w' => 278, 'h' => 206, 'n' => '278x206_'),<br>
2 => array('w' => 178, 'h' => 106, 'n' => '178x106_')<br>
);<br>
foreach ($thumb as $k => $v){<br>
$image->thumb($v['w'],$v['h'], 2); // 设置宽高和缩略类型<br>
// 保存缩略图片<br>
$smallimg[$k]= $info['savepath'] . "$v[n]" . $info['savename'];<br>
<br>
$image->save($upload->rootPath . $smallimg[$k]);<br>
$_POST['small'.$k] = $smallimg[$k];<br>
}<br>
$_POST['goods_img'] = $img;<br>
<br>
}<br>
var_dump($_POST);exit;