[BUGFIX] Create processed file object if file exists but reference doesn't 83/47783/3
authorArno Schoon <arno@maxserv.nl>
Tue, 19 Apr 2016 12:26:50 +0000 (14:26 +0200)
committerFrans Saris <franssaris@gmail.com>
Tue, 19 Apr 2016 16:18:03 +0000 (18:18 +0200)
Create the target file object using the identifier of an already existing
processed file to prevent regenerating

Resolves: #75756
Releases: master, 7.6
Change-Id: I74fd770baf6690674c044288d6a61ec250b590d8
Reviewed-on: https://review.typo3.org/47783
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php

index 458f591..10c559b 100644 (file)
@@ -113,15 +113,14 @@ class LocalImageProcessor implements ProcessorInterface
         // explicitly check for the raw filename here, as we check for files that existed before we even started
         // processing, i.e. that were processed earlier
         if ($processingFolder->hasFile($task->getTargetFileName())) {
-            // If the processed file already exists, fetch it and update its properties to reflect the actual file.
-            $processedFile = $storage->getFileInFolder($task->getTargetFileName(), $processingFolder);
+            // When the processed file already exists set it as processed file
+            $task->getTargetFile()->setName($task->getTargetFileName());
+
             // If the processed file is stored on a remote server, we must fetch a local copy of the file, as we
             // have no API for fetching file metadata from a remote file.
-            $localProcessedFile = $storage->getFileForLocalProcessing($processedFile, false);
-
+            $localProcessedFile = $storage->getFileForLocalProcessing($task->getTargetFile(), false);
             $task->setExecuted(true);
             $imageDimensions = $this->getGraphicalFunctionsObject()->getImageDimensions($localProcessedFile);
-            $task->getTargetFile()->setName($task->getTargetFileName());
             $properties = array(
                 'width' => $imageDimensions[0],
                 'height' => $imageDimensions[1],