public function cropCover() { $top = \Input::get('top'); $image = $this->photo->cropImage(base_path(\Auth::getUser()->original_cover), 'cover/', 0, abs($top), 1000, 300, false); $image = str_replace('%d', 'original', $image->result()); if (!empty($image)) { /** * Update user profile cover */ $user = \Auth::user(); if ($user->cover and $user->cover != $user->original_cover) { \Image::delete($user->cover); } $this->userRepository->updateCover($image); return json_encode(['status' => 'success', 'url' => \Image::url($image)]); } else { return json_encode(['status' => 'error', 'message' => 'Error things']); } }