Example #1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     //create dir
     $storage = storage_path('app');
     !file_exists($storage . '/' . $imageModel->id) ? mkdir($storage . '/' . $imageModel->id, 0777, true) : '';
     // save file
     \Intervention::make($this->image)->save($storage . $img_slug);
     // save relations
     $this->model->photos()->save($img);
 }
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  PhotosRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PhotosRequest $request)
 {
     // input variables
     $input = \Input::except('item_id', 'item_model', 'item_type', 'image');
     $input['slug'] = \trslug::trslug(\Input::get('title'));
     $input['photo_id'] = \Input::get('item_id');
     $input['photo_type'] = \Input::get('item_type');
     $input['line'] = 0;
     // create photo
     $img = Photos::create($input);
     // save image slug&&upload
     $storagepath = storage_path('app') . '/img/photos/' . $img->id;
     $img->slug = '/img/photos/' . $img->id . '/' . $input['slug'] . '.jpg';
     $img->save();
     !file_exists($storagepath) ? mkdir($storagepath, 0777, true) : null;
     \Intervention::make(\Input::file('image'))->save($storagepath . '/' . $input['slug'] . '.jpg');
     return \Redirect::back()->with('message', 'Kaydedildi!');
 }
Example #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  AdminRequest  $request
  * @return \Illuminate\Http\Response
  */
 public function store(AdminRequest $request)
 {
     $config['brand'] = \Input::get('brand');
     $config['mail'] = \Input::get('mail');
     $config['active'] = \Input::get('active');
     $config['eng'] = \Input::get('eng');
     $config['one_page'] = \Input::get('one_page');
     $config['googlemap'] = \Input::get('googlemap');
     $config['header'] = \Input::get('header');
     if (\Input::file('ico')) {
         \File::copy(\Input::file('ico'), public_path('favicon.ico'));
     }
     \File::put(storage_path('.config'), json_encode($config));
     $custom_js = \Input::file('custom_js');
     $custom_css = \Input::file('custom_css');
     $custom_css ? $custom_css->move(storage_path('app/custom/css'), \trslug::trslug(pathinfo($custom_css->getClientOriginalName(), PATHINFO_FILENAME)) . '.css') : null;
     $custom_js ? $custom_js->move(storage_path('app/custom/js'), \trslug::trslug(pathinfo($custom_js->getClientOriginalName(), PATHINFO_FILENAME)) . '.js') : null;
     if (\Input::file('logo')) {
         \File::cleanDirectory(storage_path('app/img/.cache'));
         \Intervention::make(\Input::file('logo'))->save(storage_path('app/img/assets/logo.png'));
     }
     \Activity::log('Admin Anasayfa Güncellendi');
     return \Redirect::back()->with('message', 'Kaydedildi!');
 }
Example #4
0
 /**
  * Generates captcha code
  * @param  integer $length [default length of the captcha code]
  * @return mixed           [returns image with the captcha code]
  */
 public function captcha(\Illuminate\Http\Request $request)
 {
     $length = $request->input('length', 6);
     if ($length < 1) {
         $length = 1;
     }
     if ($length > 9) {
         $length = 9;
     }
     $random = rand(pow(10, $length - 1), pow(10, $length) - 1);
     session()->put('captcha', $random);
     $img = \Intervention::make('img/captcha/texture.jpg');
     /* progressive image */
     $img->interlace();
     $img->text(session('captcha', $random), rand(51, 57), rand(13, 18), function ($font) use($length) {
         $font->file('img/captcha/courbd-font.ttf');
         $font->size(28 - $length);
         $font->color('#888888');
         $font->align('center');
         $font->valign('middle');
         $font->angle(rand(-4, 4));
     });
     /* blur image */
     // $img->blur(2);
     /* just add a tone to the image */
     $img->colorize(rand(-20, 20), rand(-20, 20), rand(-20, 20));
     return $img->response();
 }