예제 #1
0
 public function postRedactor(Request $request)
 {
     $res = ['response' => 'YES', 'status' => 0];
     $type = 'redactor';
     if ($request->hasFile('file')) {
         $imgInfos = ImageTools::resize($request, $type);
         if (!empty($imgInfos)) {
             $img = Img::create(['img_cuid' => $request->user()->user_id, 'img_block' => $type, 'img_filename' => $imgInfos['imgName'], 'img_filetype' => $imgInfos['imgType'], 'img_uri' => $imgInfos['imgUri'], 'img_hd' => $imgInfos['hd'], 'img_big' => $imgInfos['big'], 'img_small' => $imgInfos['small'], 'img_tiny' => $imgInfos['tiny'], 'img_square' => $imgInfos['square'], 'img_active' => 0]);
             $res['status'] = 1;
             $res['id'] = $img->img_id;
             $res['filelink'] = $img->img_small;
             $res['msgSuccess'] = '成功';
         } else {
             $res = '没有上传成功哦,稍后再试吧';
         }
     } else {
         $res['msgError'] = '没有文件';
     }
     return response()->json($res);
 }