public function post_upload($galleryID)
 {
     $path = path('public') . 'images/' . $galleryID;
     Fineuploader::init($path);
     $name = Fineuploader::getName();
     $fuResponse = Fineuploader::upload($name);
     if (isset($fuResponse['success']) && $fuResponse['success'] == true) {
         $file = Fineuploader::getUploadName();
         Bundle::start('resizer');
         $success = Resizer::open($file)->resize(300, 300, 'landscape')->save($path . '/thumbs/' . $name, 90);
         Images::create($galleryID, $name);
     }
     return Response::json($fuResponse);
 }
Exemple #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $rules = array('album_id' => 'required', 'myimage' => 'required|image');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         var_dump($validator->errors());
         // ->withErrors($validator)
         // ->withInput();
     }
     //$data = $request->only('album_id','myimage');
     //$img_data = $this->_dataurlToFile($data['cover_image']);
     // $f = finfo_open();
     // $extension = finfo_buffer($f, $img_data, FILEINFO_MIME_TYPE);
     // $f = finfo_close($f);
     // $input = array('cover_image' => $decodedData);
     // var_dump($input);
     //$file = $request->file('cover_image');
     // $random_name = str_random(8);
     $destinationPath = 'storage/users/albums/';
     //$filename=$random_name.'_cover.png';//.$extension;
     $file = $request->file('myimage');
     $filename = $file->getClientOriginalName();
     $file->move($destinationPath, $filename);
     // //$srcPath = $file->getRealPath();
     // var_dump($file->move('temp', $filename));
     // return;
     //Storage::move($data['myimage'],$destinationPath."test.jpg");
     // $uploadSuccess = $request->file('cover_image')
     // ->move($destinationPath, $filename);
     $album = Images::create(array('image' => $filename, 'album_id' => $request->album_id));
     return redirect('photos/' . $request->album_id);
     //,['id'=>$album->id]
 }