[TASK] Use constants for 'Image.CropScaleMask' and 'Image.CropScaleMask' 00/53400/2
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Tue, 4 Jul 2017 20:01:21 +0000 (22:01 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 5 Jul 2017 14:43:38 +0000 (16:43 +0200)
Constants ProcessedFile::CONTEXT_IMAGECROPSCALEMASK and
ProcessedFile::CONTEXT_IMAGEPREVIEW are now used instead of strings.

Resolves: #81790
Releases: master
Change-Id: I3f8aa0dcbe4cb292f8fe8c6993ecf025c786d70b
Reviewed-on: https://review.typo3.org/53400
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Resource/OnlineMedia/Processing/PreviewProcessing.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/Controller/ShowImageController.php

index d89ff7f..2be936c 100644 (file)
@@ -61,7 +61,7 @@ class PreviewProcessing
      */
     public function processFile(FileProcessingService $fileProcessingService, AbstractDriver $driver, ProcessedFile $processedFile, File $file, $taskType, array $configuration)
     {
-        if ($taskType !== 'Image.Preview' && $taskType !== 'Image.CropScaleMask') {
+        if ($taskType !== ProcessedFile::CONTEXT_IMAGEPREVIEW && $taskType !== ProcessedFile::CONTEXT_IMAGECROPSCALEMASK) {
             return;
         }
         // Check if processing is needed
@@ -80,7 +80,7 @@ class PreviewProcessing
         }
         $temporaryFileNameForResizedThumb = uniqid(PATH_site . 'typo3temp/var/transient/online_media_' . $file->getHashedIdentifier()) . '.jpg';
         switch ($taskType) {
-            case 'Image.Preview':
+            case ProcessedFile::CONTEXT_IMAGEPREVIEW:
                 // Merge custom configuration with default configuration
                 $configuration = array_merge(['width' => 64, 'height' => 64], $configuration);
                 $configuration['width'] = MathUtility::forceIntegerInRange($configuration['width'], 1, 1000);
@@ -88,7 +88,7 @@ class PreviewProcessing
                 $this->resizeImage($temporaryFileName, $temporaryFileNameForResizedThumb, $configuration);
                 break;
 
-            case 'Image.CropScaleMask':
+            case ProcessedFile::CONTEXT_IMAGECROPSCALEMASK:
                 $this->cropScaleImage($temporaryFileName, $temporaryFileNameForResizedThumb, $configuration);
                 break;
         }
index 867c482..9a687ed 100644 (file)
@@ -1330,7 +1330,7 @@ class ContentObjectRenderer
                     }
                 }
 
-                $processedFile = $file->process('Image.CropScaleMask', $conf);
+                $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $conf);
                 $JSwindowExpand = isset($conf['JSwindow.']['expand.']) ? $this->stdWrap($conf['JSwindow.']['expand'], $conf['JSwindow.']['expand.']) : $conf['JSwindow.']['expand'];
                 $offset = GeneralUtility::intExplode(',', $JSwindowExpand . ',');
                 $newWindow = isset($conf['JSwindow.']['newWindow.']) ? $this->stdWrap($conf['JSwindow.']['newWindow'], $conf['JSwindow.']['newWindow.']) : $conf['JSwindow.']['newWindow'];
index 62748b0..b53b405 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Frontend\Controller;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Core\Exception;
+use TYPO3\CMS\Core\Resource\ProcessedFile;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
@@ -182,7 +183,7 @@ EOF;
             'frame' => $this->frame,
             'crop' => $this->crop,
         ];
-        return $this->file->process('Image.CropScaleMask', $processingConfiguration);
+        return $this->file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration);
     }
 
     /**