[BUGFIX] Only downscale images in ProcessedFile::CONTEXT_IMAGEPREVIEW 75/38475/3
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:22:17 +0000 (19:22 +0200)
Resolves: #66270
Releases: master, 6.2
Change-Id: I8bfe273309e847c8dd185aa9c6cd35b57b2f86f3
Reviewed-on: http://review.typo3.org/38475
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Resource/Processing/LocalPreviewHelper.php

index bbf0ab1..69dd5b3 100644 (file)
@@ -45,7 +45,7 @@ class LocalPreviewHelper {
         * removes the typo3temp/ file
         *
         * @param TaskInterface $task
-        * @return array
+        * @return array|NULL
         */
        public function process(TaskInterface $task) {
                $sourceFile = $task->getSourceFile();
@@ -55,6 +55,12 @@ class LocalPreviewHelper {
                $configuration['width'] = MathUtility::forceIntegerInRange($configuration['width'], 1);
                $configuration['height'] = 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