diff --git a/Classes/Resource/Processing/DeferredImageProcessor.php b/Classes/Resource/Processing/DeferredImageProcessor.php index 4d2d6ba..85a3baa 100644 --- a/Classes/Resource/Processing/DeferredImageProcessor.php +++ b/Classes/Resource/Processing/DeferredImageProcessor.php @@ -16,10 +16,12 @@ public function canProcessTask(TaskInterface $task): bool { return $task->getType() === 'Image' && $task->getName() === 'CropScaleMask' + && ( + str_starts_with($task->getSourceFile()->getMimeType(), 'image/') + || $task->getSourceFile()->getMimeType() === 'application/pdf' + ) && $task->getSourceFile()->getMimeType() !== 'image/svg+xml' - && $task->getSourceFile()->getExtension() !== 'svg' - && $task->getSourceFile()->getMimeType() !== 'application/pdf' - && $task->getSourceFile()->getExtension() !== 'pdf'; + && $task->getSourceFile()->getExtension() !== 'svg'; } public function processTask(TaskInterface $task): void @@ -35,15 +37,17 @@ public function processTask(TaskInterface $task): void $task->setExecuted($localTask->isSuccessful()); } } else { - if (!$this->canProcessTask($task)) { - throw new \InvalidArgumentException('Cannot process task of type "' . $task->getType() . '.' . $task->getName() . '"', 1350570621); - } if ($this->checkForExistingTargetFile($task)) { return; } $imageDimensions = ImageDimension::fromProcessingTask($task); - if ($imageDimensions->getWidth() === $task->getTargetFile()->getOriginalFile()->getProperty('width') && $imageDimensions->getHeight() === $task->getTargetFile()->getOriginalFile()->getProperty('height') && !$task->getConfiguration()['crop']) { + if ( + $imageDimensions->getWidth() === $task->getTargetFile()->getOriginalFile()->getProperty('width') + && $imageDimensions->getHeight() === $task->getTargetFile()->getOriginalFile()->getProperty('height') + && !$task->getConfiguration()['crop'] + && $task->getSourceFile()->getMimeType() !== 'application/pdf' + ) { // If the target image dimensions are identical to the original file and no cropping is defined, do not process, but use the original file $task->setExecuted(true); $task->getTargetFile()->setUsesOriginalFile();