From fc6ca2a1bf49c9a1c324bf44c119a0b667f6922c Mon Sep 17 00:00:00 2001 From: Devid Messner Date: Tue, 12 Sep 2017 15:25:24 +0200 Subject: [PATCH 1/2] fix image crop problem in Typo3 8.7 --- Classes/Resource/Rendering/ImageRenderer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/Resource/Rendering/ImageRenderer.php b/Classes/Resource/Rendering/ImageRenderer.php index 07fbec8..5dd3034 100644 --- a/Classes/Resource/Rendering/ImageRenderer.php +++ b/Classes/Resource/Rendering/ImageRenderer.php @@ -139,7 +139,9 @@ public function render( try { $cropVariantCollection = CropVariantCollection::create((string)$file->getProperty('crop')); $defaultCropArea = $cropVariantCollection->getCropArea(); - $defaultProcessConfiguration['crop'] = !$defaultCropArea->isEmpty() ? $defaultCropArea : null; + $defaultProcessConfiguration['crop'] = !$defaultCropArea->isEmpty() ? + $defaultCropArea->makeAbsoluteBasedOnFile($file) : + null; } catch (\Exception $e) { $defaultProcessConfiguration['crop'] = null; } From 2627b65f9872ab75697258ab3b37b310bd0f19c5 Mon Sep 17 00:00:00 2001 From: Devid Messner Date: Tue, 12 Sep 2017 17:26:02 +0200 Subject: [PATCH 2/2] fix default height/width settings --- Classes/Resource/Rendering/ImageRenderer.php | 9 ++++++--- Resources/Private/Language/locallang_be.xlf | 3 +++ ext_conf_template.txt | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Classes/Resource/Rendering/ImageRenderer.php b/Classes/Resource/Rendering/ImageRenderer.php index 5dd3034..13963b2 100644 --- a/Classes/Resource/Rendering/ImageRenderer.php +++ b/Classes/Resource/Rendering/ImageRenderer.php @@ -129,13 +129,16 @@ public function render( $originalFile = $file; } - $defaultProcessConfiguration = []; + $defaultProcessConfiguration = [ + 'height' => $height, + 'width' => $width + ]; + if ($this->getConfiguration()->getExtensionConfiguration()['enableSmallDefaultImage']) { $defaultProcessConfiguration['width'] = '360m'; - } else { - $defaultProcessConfiguration['width'] = $this->defaultWidth . 'm'; } + try { $cropVariantCollection = CropVariantCollection::create((string)$file->getProperty('crop')); $defaultCropArea = $cropVariantCollection->getCropArea(); diff --git a/Resources/Private/Language/locallang_be.xlf b/Resources/Private/Language/locallang_be.xlf index fe97a7c..8795046 100644 --- a/Resources/Private/Language/locallang_be.xlf +++ b/Resources/Private/Language/locallang_be.xlf @@ -6,6 +6,9 @@ Enable small(360px width) default image? (Useful with polyfills) + + Width for Small Default Images + diff --git a/ext_conf_template.txt b/ext_conf_template.txt index 85648f8..5a537ea 100644 --- a/ext_conf_template.txt +++ b/ext_conf_template.txt @@ -1,2 +1,5 @@ # cat=basic/enable; type=boolean; label=LLL:EXT:fluid_styled_responsive_images/Resources/Private/Language/locallang_be.xlf:extconf.enableSmallDefaultImage enableSmallDefaultImage = 1 + +# cat=basic/enable; type=string; label=LLL:EXT:fluid_styled_responsive_images/Resources/Private/Language/locallang_be.xlf:extconf.smallDefaultImageWidth +smallDefaultImageWidth = 360m