Esempio n. 1
0
 public function renderImageAction($image)
 {
     $width = $this->getWidth($image);
     $imageSource = str_replace('-' . $width, '', $image);
     $imagePath = $this->glide->makeImage($imageSource, ['w' => $width]);
     $imageBase = $this->glide->getCache()->read($imagePath);
     $this->glide->getCache()->put($image, $imageBase);
     $this->glide->outputImage($imageSource, ['w' => $width]);
 }
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     $this->package('spatie/laravel-glide');
     $glideConfig = $this->app['config']->get('laravel-glide::config');
     $this->app['router']->get($glideConfig['baseURL'] . '/{all}', function () use($glideConfig) {
         $request = $this->app['request'];
         SignatureFactory::create($this->app['config']->get('app.key'))->validateRequest($request);
         // Set image source
         $source = new Filesystem(new Local($glideConfig['source']['path']));
         // Set image cache
         $cache = new Filesystem(new Local($glideConfig['cache']['path']));
         $this->writeIgnoreFile($glideConfig['cache']['path']);
         $api = GlideApiFactory::create();
         // Setup Glide server
         $server = new Server($source, $cache, $api);
         $server->setBaseUrl($glideConfig['baseURL']);
         echo $server->outputImage($request);
     })->where('all', '.*');
 }
Esempio n. 3
0
 public function getFile(Server $server, Request $request, $path)
 {
     $server->outputImage($path, $request->all());
 }
Esempio n. 4
0
 public static function getPhoto(Server $server, Request $request, $id, $file)
 {
     $photo_file = $file;
     $path = "post/{$id}/photo/{$photo_file}";
     return $server->outputImage($path, $_GET);
 }
Esempio n. 5
0
 public function image(Server $server, Request $request)
 {
     $server->outputImage($request);
 }
Esempio n. 6
0
 public function show(GlideServer $server, Request $request)
 {
     return $server->outputImage(strtok($request->server->get('REQUEST_URI'), '?'), $request->all());
 }