示例#1
0
 /**
  * Upload images
  * 
  * @param Content $content
  * @return \Illiminate\Http\JsonResponse
  */
 public function upload(Content $content)
 {
     // Process seo image
     if ($file = \Request::file('image_uploader')) {
         $filename = md5(microtime()) . '.' . $file->getClientOriginalExtension();
         $file->move(public_path($content->getGalleryPath()), $filename);
         // Go resize if not empty
         $maxWidth = \Input::get('image_max_width');
         if (!empty($maxWidth)) {
             $content->resizeImage(public_path($content->getGalleryPath() . '/' . $filename), $maxWidth);
         }
     }
     // Response
     return response()->json(['success' => true]);
 }