diff --git a/Classes/DataProcessing/FilesProcessor.php b/Classes/DataProcessing/FilesProcessor.php index 65454c75..b82d985f 100644 --- a/Classes/DataProcessing/FilesProcessor.php +++ b/Classes/DataProcessing/FilesProcessor.php @@ -174,7 +174,13 @@ protected function processFiles(array $properties = []): ?array foreach ($this->fileObjects as $key => $fileObject) { if (isset($this->processorConfiguration['processingConfiguration.']['autogenerate.'])) { - $file = $this->getFileUtility()->processFile($fileObject, $properties, $cropVariant); + $file = $this->getFileUtility()->processFile( + $fileObject, + $properties, + $cropVariant, + (int)($this->processorConfiguration['processingConfiguration.']['delayProcessing'] ?? 0) === 1 + ); + $targetWidth = (int)($properties['width'] ?: $file['properties']['dimensions']['width']); $targetHeight = (int)($properties['height'] ?: $file['properties']['dimensions']['height']); diff --git a/Classes/DataProcessing/GalleryProcessor.php b/Classes/DataProcessing/GalleryProcessor.php index 7e6dd161..15d62f10 100644 --- a/Classes/DataProcessing/GalleryProcessor.php +++ b/Classes/DataProcessing/GalleryProcessor.php @@ -184,8 +184,8 @@ protected function prepareGalleryData() $fileObj = $this->fileObjects[$fileKey] ?? null; if ($fileObj) { - if (($this->equalMediaWidth || $this->equalMediaHeight) && $fileObj['properties']['type'] === 'image') { - $image = $this->getImageService()->getImage($fileObj['properties']['originalUrl'], null, true); + if ($fileObj['properties']['type'] === 'image') { + $image = $this->getImageService()->getImage((string)$fileObj['properties']['fileReferenceUid'], null, true); $fileObj = $this->getFileUtility()->processFile($image, $this->mediaDimensions[$fileKey] ?? []); if (isset($this->processorConfiguration['autogenerate.']['retina2x'], diff --git a/Classes/Utility/FileUtility.php b/Classes/Utility/FileUtility.php index 3f1eac2c..69a876a0 100644 --- a/Classes/Utility/FileUtility.php +++ b/Classes/Utility/FileUtility.php @@ -75,12 +75,10 @@ public function __construct( } /** - * @param FileInterface $fileReference * @param array $dimensions - * @param string $cropVariant * @return array */ - public function processFile(FileInterface $fileReference, array $dimensions = [], string $cropVariant = 'default'): array + public function processFile(FileInterface $fileReference, array $dimensions = [], string $cropVariant = 'default', bool $delayProcessing = false): array { $fileReferenceUid = $fileReference->getUid(); $uidLocal = $fileReference->getProperty('uid_local'); @@ -107,7 +105,7 @@ public function processFile(FileInterface $fileReference, array $dimensions = [] ]; if ($fileRenderer === null && $fileReference->getType() === AbstractFile::FILETYPE_IMAGE) { - if ($fileReference->getMimeType() !== 'image/svg+xml') { + if (!$delayProcessing && $fileReference->getMimeType() !== 'image/svg+xml') { $fileReference = $this->processImageFile($fileReference, $dimensions, $cropVariant); } $publicUrl = $this->imageService->getImageUri($fileReference, true); diff --git a/Configuration/TypoScript/ContentElement/Image.typoscript b/Configuration/TypoScript/ContentElement/Image.typoscript index 81dadf7d..98026046 100755 --- a/Configuration/TypoScript/ContentElement/Image.typoscript +++ b/Configuration/TypoScript/ContentElement/Image.typoscript @@ -11,6 +11,9 @@ tt_content.image { 10 { references.fieldName = image as = files + processingConfiguration { + delayProcessing = 1 + } } 20 = FriendsOfTYPO3\Headless\DataProcessing\GalleryProcessor 20 { diff --git a/Configuration/TypoScript/ContentElement/Textmedia.typoscript b/Configuration/TypoScript/ContentElement/Textmedia.typoscript index 869154d4..a187c251 100755 --- a/Configuration/TypoScript/ContentElement/Textmedia.typoscript +++ b/Configuration/TypoScript/ContentElement/Textmedia.typoscript @@ -16,6 +16,9 @@ tt_content.textmedia { 10 { references.fieldName = assets as = files + processingConfiguration { + delayProcessing = 1 + } } 20 = FriendsOfTYPO3\Headless\DataProcessing\GalleryProcessor 20 { diff --git a/Configuration/TypoScript/ContentElement/Textpic.typoscript b/Configuration/TypoScript/ContentElement/Textpic.typoscript index afd759c6..2fac0d92 100755 --- a/Configuration/TypoScript/ContentElement/Textpic.typoscript +++ b/Configuration/TypoScript/ContentElement/Textpic.typoscript @@ -16,6 +16,9 @@ tt_content.textpic { 10 { references.fieldName = image as = files + processingConfiguration { + delayProcessing = 1 + } } 20 = FriendsOfTYPO3\Headless\DataProcessing\GalleryProcessor 20 {