コード例 #1
0
 public function run()
 {
     DB::table('filter_images')->delete();
     $success = File::cleanDirectory($this->getImagesPath());
     File::put($this->getImagesPath() . '.gitignore', File::get(public_path() . '/../app/storage/cache/.gitignore'));
     // Create images for all filters. In this phase images for all the filter will be the same
     $filters = Filter::all();
     foreach ($filters as $filter) {
         FilterImage::create(['filter_id' => $filter->id, 'image_name' => $this->copyImage(public_path() . '/backup_images/filters/gym.jpg')]);
         //            FilterImage::create([
         //                'filter_id' => $filter->id,
         //                'image_name' => $this->copyImage(public_path().'/backup_images/filters/hero.jpg')
         //            ]);
         //
         //            FilterImage::create([
         //                'filter_id' => $filter->id,
         //                'image_name' => $this->copyImage(public_path().'/backup_images/filters/kitchen.jpg')
         //            ]);
         //
         //            FilterImage::create([
         //                'filter_id' => $filter->id,
         //                'image_name' => $this->copyImage(public_path().'/backup_images/filters/living.jpg')
         //            ]);
     }
 }
コード例 #2
0
 public function postDutchKillsPage($id = null)
 {
     $input = Input::all();
     if ($id) {
         if ($input['poi_url_file']) {
             $data['poi_url'] = 'http://' . Request::server("SERVER_NAME") . Config::get('app.base_image_url') . '/' . Filter::POI_FOLDER . $this->uploadFile($input['poi_url_file'], Filter::POI_FOLDER);
         }
         $filter = Filter::findOrFail($id);
         $filter->update($data);
     } else {
         if (isset($input['image_names'])) {
             foreach ($input['image_names'] as $image) {
                 FilterImage::create(array('image_name' => $image, 'filter_id' => 0));
                 $this->dealWithImage($image, FilterImage::getImagesFolderAbsolutePath());
             }
         }
         if ($input['poi_url_file']) {
             $data['poi_url'] = 'http://' . Request::server("SERVER_NAME") . Config::get('app.base_image_url') . '/' . Filter::POI_FOLDER . $this->uploadFile($input['poi_url_file'], Filter::POI_FOLDER);
         }
         $affected = DB::table('filters')->insert(array('text' => $input['text'], 'paragraph_title' => $input['paragraph_title'], 'poi_url' => $data['poi_url']));
     }
     return Redirect::back();
 }