/** * {@inheritdoc} */ public function register(Application $app) { if (!isset($app['thumbnails'])) { $app->register(new Thumbs\ServiceProvider()); } $app['thumbnails.filesystems'] = ['files', 'themebase']; $app['thumbnails.filesystem_cache'] = $app->share(function ($app) { if (!$app['filesystem']->hasFilesystem('web')) { return null; } return $app['filesystem']->getFilesystem('web'); }); $app['thumbnails.cache'] = $app->share(function ($app) { return $app['cache']; }); $app['thumbnails.default_image'] = $app->share(function ($app) { $finder = new Thumbs\Finder($app['filesystem'], ['app', 'themebase', 'files'], new Image()); return $finder->find($app['config']->get('general/thumbnails/notfound_image')); }); $app['thumbnails.error_image'] = $app->share(function ($app) { $finder = new Thumbs\Finder($app['filesystem'], ['app', 'themebase', 'files'], new Image()); return $finder->find($app['config']->get('general/thumbnails/error_image')); }); $app['thumbnails.cache_time'] = $app['config']->get('general/thumbnails/browser_cache_time'); $app['thumbnails.limit_upscaling'] = !$app['config']->get('general/thumbnails/allow_upscale', false); $app['thumbnails.save_files'] = $app['config']->get('general/thumbnails/save_files'); ImageResource::setNormalizeJpegOrientation($app['config']->get('general/thumbnails/exif_orientation', true)); ImageResource::setQuality($app['config']->get('general/thumbnails/quality', 80)); }
public function testImageNotFoundUsesDefault() { $image = $this->finder->find('herp/derp.png'); $this->assertSame($this->fs->getFilesystem('images'), $image->getFilesystem()); $this->assertSame('samples/sample1.jpg', $image->getPath()); }