if(!empty($_FILES)){
$upload = new Upload();
$image = new \Think\Image();
$upload->maxSize = 3145728;
$upload->exts = array('jpg', 'jpeg', 'gif', 'png');
$upload->rootPath = 'Public/upload/snstopic_tiezi/';
dir_create($upload->rootPath); //根据日期创建文件夹
$info = $upload->upload($_FILES);
if(!$info){
returnInfoApi('0016','上传图片失败',$param,$upload->getError());
}else{
$path = '/Public/upload/snstopic_tiezi/'.$info['headpic']['savepath'].$info['headpic']['savename'];
$image->open('http://apidev.com'.$path);
$image->thumb(150, 150)->save('./thumb.jpg');
}
}else{
returnInfoApi('0016','上传图片失败',$param);
}
}
最佳答案