maxSize = $maxSize; $upload->allowExts = $allowExts; $upload->savePath = '../data/pic/'; // 设置附件 $upload->saveRule = time() . sprintf('%04s', mt_rand(0, 1000)); if (!$upload->upload()) {// 上传错误提示错误信息 header ('Content-type: text/html; charset=utf-8' ); echo "";exit; } else {// 上传成功 获取上传文件信息 $info = $upload->getUploadFileInfo(); $imgurl = $info[0]['savename']; $arr = explode(" x ",$_POST['filedim']); if($_POST['w'] == '' && $_POST['h'] == ''){ header ('Content-type: text/html; charset=utf-8' ); echo "";exit; }else{ $x = ceil($_POST['x1'] * ($arr[0] / 330)); $y = ceil($_POST['y1'] * ($arr[1] / 330)); $x2 = $_POST['x2']; $y2 = $_POST['y2']; $w = ceil($_POST['w']*($arr[0] / 330)); $h = ceil($_POST['h']*($arr[0] / 330)); include_once("jcrop_image.class.php"); $filep = "../data/pic/"; $pic_name = $filep . $imgurl; $crop = new jcrop_image($filep, $pic_name, $x, $y, $w, $h, $w, $h); $file = $crop->crop(); header ('Content-type: text/html; charset=utf-8' ); echo "";exit; } } ?>