Revert "[BUGFIX] Fallback to argument values in f:image/f:media on invalid dimensions" 18/44718/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Sat, 14 Nov 2015 17:42:41 +0000 (18:42 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Sat, 14 Nov 2015 17:42:58 +0000 (18:42 +0100)
As discussed with helhum there are edge cases where for example width=100m and height=100m. This is not easily solvable in a viewhelper when image processing is not available.

This reverts commit 97c0da203f5d75ae5ddf527b02948d5264cc612d.

Resolves: #71576
Reverts: #54772
Reverts: #40254
Releases: master
Change-Id: Ic8a4c31d018db9576ec8b118a778fb382e22c816
Reviewed-on: https://review.typo3.org/44718
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php

index 9eee065..73c5720 100644 (file)
@@ -120,26 +120,11 @@ class ImageViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedV
             'crop' => $crop,
         );
         $processedImage = $this->imageService->applyProcessingInstructions($image, $processingInstructions);
-        $tagWidthAttribute = (int)$processedImage->getProperty('width');
-        $tagHeightAttribute = (int)$processedImage->getProperty('height');
-        $trimmedWidthAttribute = (int)trim($width, 'cm');
-        $trimmedHeightAttribute = (int)trim($height, 'cm');
-
-        if ($trimmedWidthAttribute !== $tagWidthAttribute) {
-            $tagWidthAttribute = $trimmedWidthAttribute;
-        }
-        if ($trimmedHeightAttribute !== $tagHeightAttribute) {
-            $tagHeightAttribute = $trimmedHeightAttribute;
-        }
         $imageUri = $this->imageService->getImageUri($processedImage, $absolute);
 
         $this->tag->addAttribute('src', $imageUri);
-        if (!empty($tagWidthAttribute)) {
-            $this->tag->addAttribute('width', $tagWidthAttribute);
-        }
-        if (!empty($tagHeightAttribute)) {
-            $this->tag->addAttribute('height', $tagHeightAttribute);
-        }
+        $this->tag->addAttribute('width', $processedImage->getProperty('width'));
+        $this->tag->addAttribute('height', $processedImage->getProperty('height'));
 
         $alt = $image->getProperty('alternative');
         $title = $image->getProperty('title');
index 7bdca6c..f967a09 100644 (file)
@@ -116,26 +116,11 @@ class MediaViewHelper extends AbstractTagBasedViewHelper
         );
         $imageService = $this->getImageService();
         $processedImage = $imageService->applyProcessingInstructions($image, $processingInstructions);
-        $tagWidthAttribute = (int)$processedImage->getProperty('width');
-        $tagHeightAttribute = (int)$processedImage->getProperty('height');
-        $trimmedWidthAttribute = (int)trim($width, 'cm');
-        $trimmedHeightAttribute = (int)trim($height, 'cm');
-
-        if ($trimmedWidthAttribute !== $tagWidthAttribute) {
-            $tagWidthAttribute = $trimmedWidthAttribute;
-        }
-        if ($trimmedHeightAttribute !== $tagHeightAttribute) {
-            $tagHeightAttribute = $trimmedHeightAttribute;
-        }
         $imageUri = $imageService->getImageUri($processedImage);
 
         $this->tag->addAttribute('src', $imageUri);
-        if (!empty($tagWidthAttribute)) {
-            $this->tag->addAttribute('width', $tagWidthAttribute);
-        }
-        if (!empty($tagHeightAttribute)) {
-            $this->tag->addAttribute('height', $tagHeightAttribute);
-        }
+        $this->tag->addAttribute('width', $processedImage->getProperty('width'));
+        $this->tag->addAttribute('height', $processedImage->getProperty('height'));
 
         $alt = $image->getProperty('alternative');
         $title = $image->getProperty('title');