Exemple #1
0
 public function ajaxImageUpload()
 {
     $user_id = Input::get('user_id');
     $file = Input::file('display_image');
     //get the image folder to store the image, in this case the specific restaurant folder.
     $image_folder = '/assets/images/users/';
     //upload the image and return the file path
     $file_path = Image::uploadImage($file, $image_folder);
     if ($file_path['status'] != 1) {
         return Response::json(['success' => false, 'errors' => $file_path['errors']]);
     }
     $user = User::find($user_id);
     $user->display_image = $file_path['data'];
     $user->save();
     User::updateUserSession();
     return Response::json(['success' => true, 'message' => 'Profile Image Updated.', 'file' => $user->display_image]);
 }