这是一个添加图像部分代码,适用于jquery数组图像上传,我正在尝试将高度500设置为500宽度并调整imag的大小
{
$imgfield = "file".$i;
if($_FILES[$imgfield]['size'] != 0)
{
$errors= array();
$file_size =$_FILES[$imgfield]['size'];
$file_tmp =$_FILES[$imgfield]['tmp_name'];
$file_type=$_FILES[$imgfield]['type'];
$file_ext=strtolower(end(explode('.',$_FILES[$imgfield]['name'])));
$photo_name = $member_id."_".time()."_".$i.".".$file_ext;
$expensions= array("jpeg","jpg","png");
if(in_array($file_ext,$expensions)=== false){
$errors[]="extension not allowed, please choose a JPEG or PNG file.";
}
if($file_size > 2097152)]{
$errors[]='File size must be excately 2 MB'
}
if(empty($errors)==true){
move_uploaded_file($file_tmp,"images/user/product photo/temp/".$photo_name);
$images[] = $photo_name;
echo "Success";
}else{
$error="Your Image Size is more then 2 MB , Please Reduce Your Image Size and Upload Again.";
}
}
}