示例#1
0
 /**
  * 多文件缩略图
  *
  * @param array $setting {@link getDefaultOptions()}
  * @param string $basename
  * @param bool $cleanSquid
  * @return array 出错返回 false
  */
 public function thumbAll($setting, $basename = null, $cleanSquid = false)
 {
     $setting = CMap::mergeArray($this->getDefaultOptions(), $setting);
     $upload = $setting['upload'];
     $isCheck = $upload['isCheck'];
     unset($setting['upload']);
     unset($upload['isCheck']);
     $model = UploadForm::getInstance($upload);
     if ($isCheck && !$model->validate()) {
         $this->_error = implode($model->getErrors('filedata'));
         return false;
     }
     $infos = array();
     empty($basename) && ($basename = uniqid() . sprintf('%07x', mt_rand(1000000, 9999999)));
     foreach ($model->filedata as $id => $cu) {
         $file['name'] = $cu->name;
         $file['size'] = $cu->size;
         $file['type'] = $cu->type;
         $file['temp'] = $cu->tempName;
         $info = $this->handleFile($file, $setting, $basename, $cleanSquid, $id);
         if (!$info) {
             return false;
         }
         $infos[] = $info;
     }
     return $infos;
 }