diff --git a/Classes/Resource/Rendering/ImageRenderer.php b/Classes/Resource/Rendering/ImageRenderer.php index 07fbec8..13963b2 100644 --- a/Classes/Resource/Rendering/ImageRenderer.php +++ b/Classes/Resource/Rendering/ImageRenderer.php @@ -129,17 +129,22 @@ 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(); - $defaultProcessConfiguration['crop'] = !$defaultCropArea->isEmpty() ? $defaultCropArea : null; + $defaultProcessConfiguration['crop'] = !$defaultCropArea->isEmpty() ? + $defaultCropArea->makeAbsoluteBasedOnFile($file) : + null; } catch (\Exception $e) { $defaultProcessConfiguration['crop'] = null; } 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