diff --git a/Classes/FusionObjects/AssetImageSourceImplementation.php b/Classes/FusionObjects/AssetImageSourceImplementation.php index 55c27e9..f3c0dc5 100644 --- a/Classes/FusionObjects/AssetImageSourceImplementation.php +++ b/Classes/FusionObjects/AssetImageSourceImplementation.php @@ -2,12 +2,26 @@ namespace Sitegeist\Kaleidoscope\FusionObjects; use Neos\Flow\Annotations as Flow; +use Neos\Flow\ResourceManagement\ResourceManager; use Sitegeist\Kaleidoscope\EelHelpers\ImageSourceHelperInterface; use Sitegeist\Kaleidoscope\EelHelpers\AssetImageSourceHelper; -use Neos\Fusion\FusionObjects\AbstractFusionObject; +use Sitegeist\Kaleidoscope\EelHelpers\UriImageSourceHelper; class AssetImageSourceImplementation extends AbstractImageSourceImplementation { + /** + * @Flow\Inject + * @var ResourceManager + */ + protected $resourceManager; + + /** + * @var array + */ + protected $nonScalableMediaTypes = [ + 'image/svg+xml' + ]; + /** * @return mixed */ @@ -36,6 +50,11 @@ public function createHelper() : ?ImageSourceHelperInterface return null; } + if (in_array($asset->getResource()->getMediaType(), $this->nonScalableMediaTypes)) { + $uri = $this->resourceManager->getPublicPersistentResourceUri($asset->getResource()); + return new UriImageSourceHelper($uri); + } + $helper = new AssetImageSourceHelper($asset); $helper->setAsync((bool)$this->getAsync()); $helper->setRequest($this->getRuntime()->getControllerContext()->getRequest()); diff --git a/Classes/FusionObjects/DummyImageSourceImplementation.php b/Classes/FusionObjects/DummyImageSourceImplementation.php index 5fd2270..3651606 100644 --- a/Classes/FusionObjects/DummyImageSourceImplementation.php +++ b/Classes/FusionObjects/DummyImageSourceImplementation.php @@ -4,7 +4,6 @@ use Neos\Flow\Annotations as Flow; use Sitegeist\Kaleidoscope\EelHelpers\ImageSourceHelperInterface; use Sitegeist\Kaleidoscope\EelHelpers\DummyImageSourceHelper; -use Neos\Fusion\FusionObjects\AbstractFusionObject; class DummyImageSourceImplementation extends AbstractImageSourceImplementation { diff --git a/Classes/FusionObjects/UriImageSourceImplementation.php b/Classes/FusionObjects/UriImageSourceImplementation.php index 19965da..45f1b2e 100644 --- a/Classes/FusionObjects/UriImageSourceImplementation.php +++ b/Classes/FusionObjects/UriImageSourceImplementation.php @@ -3,7 +3,6 @@ use Neos\Flow\Annotations as Flow; use Sitegeist\Kaleidoscope\EelHelpers\ImageSourceHelperInterface; -use Sitegeist\Kaleidoscope\EelHelpers\ResourceImageSourceHelper; use Neos\Fusion\FusionObjects\AbstractFusionObject; use Sitegeist\Kaleidoscope\EelHelpers\UriImageSourceHelper;