Esempio n. 1
0
 if (!$_B['uid']) {
     jsonOutput(2, 'login');
 }
 $upload->init($_FILES['file'], 'article', 'data/attachment');
 $file =& $upload->file;
 if (!$file['isimage']) {
     jsonOutput(2, '请上传图片附件  0027');
 }
 if ($file['size'] > 2097152) {
     //2M
     jsonOutput(2, '请上传小余 2M 的图片  0032');
 }
 $upload->save($file['tmp_name'], $file['target']);
 $errorcode = $upload->error();
 if ($errorcode < 0) {
     $data = $upload->errormsg();
     @unlink($file['target']);
     jsonOutput(2, $data);
 }
 //判断是否开启了exif,并获取照片的exif信息
 $my_exif = array();
 if (extension_loaded('exif') && extension_loaded('mbstring')) {
     $my_exif = exif_read_data($file['target'], "EXIF");
 }
 $image = new class_image($file['target']);
 $image->exif = $my_exif;
 $status = $image->Thumb();
 if ($status <= 0) {
     $data = $image->errormsg($status);
     @unlink($file['target']);
     jsonOutput(2, $data);