//上传图片并压缩
public function upload_img($img,$imgpath){
$res['code']=0;
if ($img['error'] > 0) {
switch ($img['error']) {
case 1:
$res['msg']="上传图片大小超出配置文件规定值";
break;
case 2:
$res['msg']="上传图片大小超出表单中的约定值";
break;
case 3:
$res['msg']="上传图片不全";
break;
case 4:
$res['msg']="没有上传图片";
break;
}
} else {
list($maintype, $subtype) = explode("/", $img['type']);
if ($maintype == 'image' || $subtype == 'png' || $subtype == 'jpeg' || $subtype == 'jpg') {
$name = date('Ymd',time()).rand(10000,99999).input('PictureName').'.'.$subtype;
php上传图片并压缩
最新推荐文章于 2023-07-06 16:59:52 发布