22
33namespace Networkteam \ImageProxy \Aspects ;
44
5+ use Neos \Flow \Annotations as Flow ;
56use Neos \Flow \Aop \JoinPointInterface ;
67use Neos \Flow \Mvc \ActionRequest ;
7- use Neos \Flow \ResourceManagement \ResourceManager ;
88use Neos \Media \Domain \Model \Asset ;
99use Neos \Media \Domain \Model \Image ;
1010use Neos \Media \Domain \Model \ImageVariant ;
1111use Neos \Media \Domain \Model \ThumbnailConfiguration ;
12- use Neos \ Flow \ Annotations as Flow ;
12+ use Networkteam \ ImageProxy \ Eel \ SourceUriHelper ;
1313use Networkteam \ImageProxy \ImgproxyBuilder ;
1414use Networkteam \ImageProxy \Model \Dimensions ;
1515
@@ -32,9 +32,9 @@ class ThumbnailAspect
3232
3333 /**
3434 * @Flow\Inject
35- * @var ResourceManager
35+ * @var SourceUriHelper
3636 */
37- protected $ resourceManager ;
37+ protected $ sourceUriHelper ;
3838
3939 /**
4040 * @Flow\Around("method(Neos\Media\Domain\Service\AssetService->getThumbnailUriAndSizeForAsset())")
@@ -62,17 +62,7 @@ public function generateImgproxyUri(JoinPointInterface $joinPoint): ?array
6262 $ this ->settings ['salt ' ]
6363 );
6464
65- $ sourceUri = '' ;
66-
67- $ resourceCollection = $ this ->resourceManager ->getCollection ($ asset ->getResource ()->getCollectionName ());
68- $ resourceStorage = $ resourceCollection ->getStorage ();
69- if (get_class ($ resourceStorage ) === 'Flownative\Aws\S3\S3Storage ' ) {
70- $ bucketName = $ resourceStorage ->getBucketName ();
71- $ keyPrefix = $ resourceStorage ->getKeyPrefix ();
72- $ sourceUri = sprintf ('s3://%s/%s/%s ' , $ bucketName , rtrim ($ keyPrefix , '/ ' ), $ asset ->getResource ()->getSha1 ());
73- } else {
74- $ sourceUri = $ this ->resourceManager ->getPublicPersistentResourceUri ($ asset ->getResource ());
75- }
65+ $ sourceUri = $ this ->sourceUriHelper ->sourceUri ($ asset ->getResource ());
7666
7767 $ targetHeight = $ configuration ->getHeight () ?? $ configuration ->getMaximumHeight () ?? 0 ;
7868 $ targetWidth = $ configuration ->getWidth () ?? $ configuration ->getMaximumWidth () ?? 0 ;
@@ -140,4 +130,5 @@ protected function getRequest(JoinPointInterface $joinPoint): ActionRequest
140130 {
141131 return $ joinPoint ->getMethodArgument ('request ' );
142132 }
133+
143134}
0 commit comments