getImage() public method

Same as {@see getFile} for images.
public getImage ( Bolt\Filesystem\Handler\ImageInterface | string $path ) : Bolt\Filesystem\Handler\ImageInterface
$path Bolt\Filesystem\Handler\ImageInterface | string
return Bolt\Filesystem\Handler\ImageInterface
示例#1
0
 /**
  * {@inheritdoc}
  */
 public function register(Application $app)
 {
     if (!isset($app['thumbnails'])) {
         $app->register(new Thumbs\ServiceProvider());
     }
     $app['thumbnails.filesystems'] = ['files', 'themes'];
     $app['thumbnails.save_files'] = $app['config']->get('general/thumbnails/save_files');
     $app['thumbnails.filesystem_cache'] = $app->share(function ($app) {
         if ($app['thumbnails.save_files'] === false) {
             return null;
         }
         if (!$app['filesystem']->hasFilesystem('web')) {
             return null;
         }
         return $app['filesystem']->getFilesystem('web');
     });
     $app['thumbnails.caching'] = $app['config']->get('general/caching/thumbnails');
     $app['thumbnails.cache'] = $app->share(function ($app) {
         if ($app['thumbnails.caching'] === false) {
             return null;
         }
         return $app['cache'];
     });
     $app['thumbnails.default_image'] = $app->share(function ($app) {
         $matcher = new Matcher($app['filesystem'], ['view', 'app', 'themes', 'files']);
         try {
             return $matcher->getImage($app['config']->get('general/thumbnails/notfound_image'));
         } catch (FileNotFoundException $e) {
             return new Image();
         }
     });
     $app['thumbnails.error_image'] = $app->share(function ($app) {
         $matcher = new Matcher($app['filesystem'], ['view', 'app', 'themes', 'files']);
         try {
             return $matcher->getImage($app['config']->get('general/thumbnails/error_image'));
         } catch (FileNotFoundException $e) {
             return new Image();
         }
     });
     $app['thumbnails.default_imagesize'] = $app['config']->get('general/thumbnails/default_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.only_aliases'] = $app['config']->get('general/thumbnails/only_aliases', false);
     $app['thumbnails.aliases'] = $app['config']->get('theme/thumbnails/aliases', []);
     ImageResource::setNormalizeJpegOrientation($app['config']->get('general/thumbnails/exif_orientation', true));
     ImageResource::setQuality($app['config']->get('general/thumbnails/quality', 80));
 }