/** * Create server instance. * @return Server The configured Glide server. */ public function getServer() { $server = new Server($this->getSource(), $this->getCache(), $this->getApi()); $server->setSourcePathPrefix($this->getSourcePathPrefix()); $server->setCachePathPrefix($this->getCachePathPrefix()); $server->setBaseUrl($this->getBaseUrl()); return $server; }
/** * Get configured server. * @return Server Configured Glide server. */ public function getServer() { $server = new Server($this->getSource(), $this->getCache(), $this->getApi()); $server->setSourcePathPrefix($this->getSourcePathPrefix()); $server->setCachePathPrefix($this->getCachePathPrefix()); $server->setDefaults($this->getDefaults()); $server->setPresets($this->getPresets()); $server->setBaseUrl($this->getBaseUrl()); $server->setResponseFactory($this->getResponseFactory()); return $server; }
/** * 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', '.*'); }
/** * @return Server */ public function getServer() { $server = new Server($this->getSource(), $this->getCache(), $this->getApi()); if ($this->baseUrl !== null) { $server->setBaseUrl($this->baseUrl); } if ($this->sourcePathPrefix !== null) { $server->setSourcePathPrefix($this->sourcePathPrefix); } if ($this->cachePathPrefix !== null) { $server->setCachePathPrefix($this->cachePathPrefix); } return $server; }
/** * Configure the Glide Server with the baseURL * * @param $source * @param $cache * @param $api * * @return Server */ protected function setGlideServer($source, $cache, $api) { $server = new Server($source, $cache, $api); $server->setBaseUrl($this->glideConfig['baseURL']); return $server; }