/** * Store a newly created client album in storage. * * @return Response */ public function store(StoreClientAlbumRequest $request) { $cover_photo = $request->files->get('album_cover_photo'); $client_album = new ClientAlbum(); $filename = time() . "-" . $cover_photo->getClientOriginalName(); $path = public_path('assets/images/album_cover_photo/' . $filename); //open image file $image = Image::make($cover_photo->getRealPath()); //resize and save file to server $image->resize(null, 600, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); })->save($path, 90); //save new photo $client_album->album_cover_photo = 'assets/images/album_cover_photo/' . $filename; $client_album->album_name = $request->album_name; $client_album->client_id = $request->client_id; $client_album->photo_selection_max = $request->photo_selection_max; $client_album->save(); mkdir(public_path("assets/images/client_albums/" . $client_album->id . "/high_res"), 0777, true); mkdir(public_path("assets/images/client_albums/" . $client_album->id . "/low_res"), 0777, true); }