Esempio n. 1
0
 public function action_crop_init()
 {
     $data['upload_id'] = Input::get('upload_id');
     // $data['article_id'] = Input::get('article_id');
     // $data['type_id'] = Input::get('type_id');
     $data["uploads"] = Model_Upload::find(Input::get('upload_id'));
     $this->template = View::forge('uploads/crop', $data, false);
 }
Esempio n. 2
0
 public function action_upload_pic()
 {
     $article = Model_Article::find(Input::get('object_id'));
     $output = Model_Upload::uploadPicture();
     $upload = Model_Upload::find($output['upload_id']);
     $article->uploads[] = $upload;
     $article->save();
     $data['response'] = json_encode($output);
     return Response::forge(View::forge('response', $data, false));
 }
Esempio n. 3
0
 public function action_remove_pic()
 {
     $article_id = Input::post('article_id');
     $img_name = Input::post('image');
     $upload_id = Input::post('upload_id');
     $type_id = Input::post('type_id');
     if ($upload_id && $type_id) {
         if ($img_name) {
             $uploads = Model_Upload::find($upload_id);
             $uploads->removeFiles();
             $xx["msg"] = "photo_deleted_successfully";
             $xx["status"] = "success";
         } else {
             $xx["msg"] = "Delete Fail";
             $xx["status"] = "fail";
         }
         $data['response'] = json_encode($xx);
     } else {
         $xx["msg"] = "Upload id or upload type not found";
         $xx["status"] = "false";
         $data['response'] = json_encode($xx);
     }
     return Response::forge(View::forge('response', $data, false));
 }