tp3.2 uses the thumb method to generate multiple thumbnails$upload = new ThinkUpload(); // Instantiate the upload class<br>
$upload->maxSize
$ Upload-& GT; Exts = Array ('jpg', 'gif', 'png', 'jpeg')
"./Public/Admin/Uploads/"; //Set the attachment upload directory//Upload files<br>
$upload ->autoSub = true;<br>
$upload ->subName = array('date','Ymd');<br>
//Set upload file rules<br>
$upload->saveRule
$info = $upload->uploadOne($_FILES['photo']);<br>
if(!$info) {<br>
// Upload error message <br>
$this->error($upload->getError());<br>
}else {<br>
// Uploaded successfully, obtained the uploaded file information <br>
$img = $info['savepath'] . $info['savename'];<br>
$image = new ThinkImage();<br>
$BinImg = $upload->rootPath . "$img"; // Get the absolute path of the original image <br>
$image->open($BinImg); // Open the original image<br>
// Add watermark <br>
// $image ->water($upload->rootPath."logo.png")-> save($upload ->rootPath.$img);<br>
// Generate a <br>
// $image ->thumb(278,206,2); // Set width, height and thumbnail type<br>
<br>
// Set thumbnail width, height, prefix <br>
$thumb = array(<br>
array('w' array('w'
2 = & gt; Array ('w' = & gt; 178, 'h' = & gt; 106, 'n' = & gt; '178x106 _') <br>
);<br>
foreach ($thumb as $k => $v){<br>
$image->thumb($v['w'],$v['h'], 2); // Set width, height and thumbnail type <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;