Skip to content

Commit

Permalink
add contao.image.resizer to studio locator
Browse files Browse the repository at this point in the history
  • Loading branch information
m-vo committed Sep 27, 2020
1 parent f7ca2e7 commit 5ffb194
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core-bundle/src/Image/Studio/ImageResult.php
Expand Up @@ -18,6 +18,7 @@
use Contao\Image\ImageInterface;
use Contao\Image\PictureConfiguration;
use Contao\Image\PictureInterface;
use Contao\Image\ResizerInterface;
use Psr\Container\ContainerInterface;
use Webmozart\PathUtil\Path;

Expand Down Expand Up @@ -152,6 +153,11 @@ private function pictureFactory(): PictureFactoryInterface
return $this->locator->get('contao.image.picture_factory');
}

private function resizer(): ResizerInterface
{
return $this->locator->get('contao.image.resizer');
}

private function staticUrl(): string
{
return $this->locator->get('contao.assets.files_context')->getStaticUrl();
Expand Down
2 changes: 2 additions & 0 deletions core-bundle/src/Image/Studio/Studio.php
Expand Up @@ -18,6 +18,7 @@
use Contao\CoreBundle\Image\PictureFactoryInterface;
use Contao\Image\ImageInterface;
use Contao\Image\PictureConfiguration;
use Contao\Image\ResizerInterface;
use Psr\Container\ContainerInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;

Expand Down Expand Up @@ -79,6 +80,7 @@ public static function getSubscribedServices(): array
self::class,
'contao.image.picture_factory' => PictureFactoryInterface::class,
'contao.image.image_factory' => ImageFactoryInterface::class,
'contao.image.resizer' => ResizerInterface::class,
'contao.assets.files_context' => ContaoContext::class,
'contao.framework' => ContaoFramework::class,
];
Expand Down
1 change: 1 addition & 0 deletions core-bundle/src/Resources/config/services.yml
Expand Up @@ -351,6 +351,7 @@ services:
public: true
tags:
- { name: container.service_subscriber, id: contao.assets.files_context }
- { name: container.service_subscriber, id: contao.image.resizer }

Contao\CoreBundle\Mailer\AvailableTransports:
arguments:
Expand Down
2 changes: 2 additions & 0 deletions core-bundle/tests/Image/Studio/StudioTest.php
Expand Up @@ -18,6 +18,7 @@
use Contao\CoreBundle\Image\PictureFactoryInterface;
use Contao\CoreBundle\Image\Studio\Studio;
use Contao\CoreBundle\Tests\TestCase;
use Contao\Image\ResizerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
Expand All @@ -39,6 +40,7 @@ public function testSubscribedServices(): void
Studio::class,
PictureFactoryInterface::class,
ImageFactoryInterface::class,
ResizerInterface::class,
ContaoFramework::class,
ContaoContext::class,
];
Expand Down

0 comments on commit 5ffb194

Please sign in to comment.