[BUGFIX] Only downscale images in ProcessedFile::CONTEXT_IMAGEPREVIEW 51/38551/2
authorFrans Saris <franssaris@gmail.com>
Fri, 3 Apr 2015 20:29:42 +0000 (22:29 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 8 Apr 2015 17:25:07 +0000 (19:25 +0200)
Resolves: #66270
Releases: master, 6.2
Change-Id: I8bfe273309e847c8dd185aa9c6cd35b57b2f86f3
Reviewed-on: http://review.typo3.org/38551
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php

index 0da23d3..63567c1 100644 (file)
@@ -41,7 +41,7 @@ class LocalPreviewHelper {
         * removes the typo3temp/ file
         *
         * @param TaskInterface $task
-        * @return array
+        * @return array|NULL
         */
        public function process(TaskInterface $task) {
                $targetFile = $task->getTargetFile();
@@ -52,6 +52,12 @@ class LocalPreviewHelper {
                $configuration['width'] = Utility\MathUtility::forceIntegerInRange($configuration['width'], 1);
                $configuration['height'] = Utility\MathUtility::forceIntegerInRange($configuration['height'], 1);
 
+               // Only scale down when new dimensions are smaller then existing image
+               if ($configuration['width'] > $sourceFile->getProperty('width')
+                       && $configuration['height'] > $sourceFile->getProperty('height')) {
+                       return NULL;
+               }
+
                $originalFileName = $sourceFile->getForLocalProcessing(FALSE);
 
                        // Create a temporaryFile