/**
  * @param ProcessedFile $processedFile
  * @return bool
  */
 protected function needsReprocessing($processedFile)
 {
     return $processedFile->isNew() || !$processedFile->usesOriginalFile() && !$processedFile->exists() || $processedFile->isOutdated();
 }
 /**
  * Processes the file
  *
  * @param Resource\ProcessedFile $processedFile
  * @param Resource\ResourceStorage $targetStorage The storage to put the processed file into
  *
  * @throws \RuntimeException
  */
 protected function process(Resource\ProcessedFile $processedFile, Resource\ResourceStorage $targetStorage)
 {
     $targetFolder = $targetStorage->getProcessingFolder();
     if (!is_object($targetFolder)) {
         throw new \RuntimeException('Could not get processing folder for storage ' . $this->storage->getName(), 1350514301);
     }
     // We only have to trigger the file processing if the file either is new, does not exist or the
     // original file has changed since the last processing run (the last case has to trigger a reprocessing
     // even if the original file was used until now)
     if ($processedFile->isNew() || !$processedFile->usesOriginalFile() && !$processedFile->exists() || $processedFile->isOutdated()) {
         $task = $processedFile->getTask();
         /** @var $processor Resource\Processing\LocalImageProcessor */
         $processor = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Processing\\LocalImageProcessor');
         $processor->processTask($task);
         if ($processedFile->isProcessed()) {
             /** @var $processedFileRepository Resource\ProcessedFileRepository */
             $processedFileRepository = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ProcessedFileRepository');
             $processedFileRepository->add($processedFile);
         }
     }
 }
 /**
  * Processes the file
  *
  * @param Resource\ProcessedFile $processedFile
  * @param Resource\ResourceStorage $targetStorage The storage to put the processed file into
  */
 protected function process(Resource\ProcessedFile $processedFile, Resource\ResourceStorage $targetStorage)
 {
     // We only have to trigger the file processing if the file either is new, does not exist or the
     // original file has changed since the last processing run (the last case has to trigger a reprocessing
     // even if the original file was used until now)
     if ($processedFile->isNew() || !$processedFile->usesOriginalFile() && !$processedFile->exists() || $processedFile->isOutdated()) {
         $task = $processedFile->getTask();
         /** @var $processor Resource\Processing\LocalImageProcessor */
         $processor = Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Processing\LocalImageProcessor::class);
         $processor->processTask($task);
         if ($task->isExecuted() && $task->isSuccessful() && $processedFile->isProcessed()) {
             /** @var $processedFileRepository Resource\ProcessedFileRepository */
             $processedFileRepository = Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ProcessedFileRepository::class);
             $processedFileRepository->add($processedFile);
         }
     }
 }
 /**
  * Processes the file
  *
  * @param ProcessedFile $optimizedProcessedFile
  * @param ProcessedFile $processedFile
  */
 protected function process(ProcessedFile $optimizedProcessedFile, ProcessedFile $processedFile)
 {
     if ($optimizedProcessedFile->isNew() || !$optimizedProcessedFile->exists() || $optimizedProcessedFile->isOutdated()) {
         /** @var OptimizeImageTask $task */
         $task = $optimizedProcessedFile->getTask();
         if ($processedFile->isProcessed() && !$processedFile->usesOriginalFile()) {
             $task->setOriginalProcessedFile($processedFile);
         }
         $this->getOptimizeImageProcessor()->processTask($task);
         if ($task->isExecuted() && $task->isSuccessful() && $optimizedProcessedFile->isProcessed()) {
             $this->processedFileRepository->add($optimizedProcessedFile);
         }
     }
 }