From 2649fec8d5191ad3a0426027ad8f371341b72cff Mon Sep 17 00:00:00 2001 From: Stefan Froemken <froemken@gmail.com> Date: Tue, 14 Feb 2017 16:56:56 +0100 Subject: [PATCH] [FEATURE] Allow overriding of image manipulation cropVariants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is not possible to change or override cropVariants via TSconfig for sys_file_reference (e.g. for a specific user or page tree branch), thus making the cropping functionality a pain for bigger sites. Setting a FormEngine option as expected like TCEFORM.sys_file_reference.crop.config.cropVariants.* does now work. Resolves: #79812 Releases: master Change-Id: I9d36f6661c2a5ca051b803f06485fdb4c8c8a437 Reviewed-on: https://review.typo3.org/51676 Reviewed-by: Frans Saris <franssaris@gmail.com> Tested-by: Frans Saris <franssaris@gmail.com> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de> Reviewed-by: Jasmina Ließmann <code@frauliessmann.de> Tested-by: Jasmina Ließmann <code@frauliessmann.de> Reviewed-by: Helmut Hummel <typo3@helhum.io> Tested-by: Helmut Hummel <typo3@helhum.io> --- .../Form/Utility/FormEngineUtility.php | 2 +- .../Imaging/ImageManipulation/Area.php | 8 ++-- .../Imaging/ImageManipulation/Ratio.php | 2 +- ...ridingCropVariantsForImageManipulation.rst | 48 +++++++++++++++++++ 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-79812-AllowOverridingCropVariantsForImageManipulation.rst diff --git a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php index aa1edccb96a5..d46d41741a40 100644 --- a/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php +++ b/typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php @@ -49,7 +49,7 @@ class FormEngineUtility 'select' => ['size', 'autoSizeMax', 'maxitems', 'minitems', 'readOnly', 'treeConfig'], 'group' => ['size', 'autoSizeMax', 'max_size', 'maxitems', 'minitems', 'readOnly'], 'inline' => ['appearance', 'behaviour', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label', 'readOnly'], - 'imageManipulation' => ['ratios'] + 'imageManipulation' => ['ratios', 'cropVariants'] ]; /** diff --git a/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php b/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php index 0c1a632905f0..7b96db8fa97a 100644 --- a/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php +++ b/typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php @@ -62,10 +62,10 @@ class Area { try { return new self( - $config['x'], - $config['y'], - $config['width'], - $config['height'] + (float)$config['x'], + (float)$config['y'], + (float)$config['width'], + (float)$config['height'] ); } catch (\Throwable $throwable) { throw new InvalidConfigurationException(sprintf('Invalid type for area property given: %s', $throwable->getMessage()), 1485279226, $throwable); diff --git a/typo3/sysext/core/Classes/Imaging/ImageManipulation/Ratio.php b/typo3/sysext/core/Classes/Imaging/ImageManipulation/Ratio.php index d13b41b8eaf8..d8301cd5d229 100644 --- a/typo3/sysext/core/Classes/Imaging/ImageManipulation/Ratio.php +++ b/typo3/sysext/core/Classes/Imaging/ImageManipulation/Ratio.php @@ -58,7 +58,7 @@ class Ratio $areas[] = new self( $id, $ratioConfig['title'], - $ratioConfig['value'] + (float)$ratioConfig['value'] ); } } catch (\Throwable $throwable) { diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-79812-AllowOverridingCropVariantsForImageManipulation.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-79812-AllowOverridingCropVariantsForImageManipulation.rst new file mode 100644 index 000000000000..f04679ee5703 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-79812-AllowOverridingCropVariantsForImageManipulation.rst @@ -0,0 +1,48 @@ +.. include:: ../../Includes.txt + +====================================================================== +Feature: #79812 - Allow overriding cropVariants for Image Manipulation +====================================================================== + +See :issue:`79812` + +Description +=========== + +With the introduction of :issue:`75880` you now can define multiple cropVariants in TCA. With this feature it is now possible to change or override these cropVariants via TSconfig. + +Setting a FormEngine option through :ts:`TCEFORM.sys_file_reference.crop.config.cropVariants.*` does now work. + + +.. code-block:: typoscript + + TCEFORM.sys_file_reference.crop.config.cropVariants { + default { + title = Default desktop + selectedRatio = NaN + allowedAspectRatios { + NaN { + title = free + value = 0.0 + } + } + } + specialMobile { + title = Our special mobile variant + selectedRatio = NaN + allowedAspectRatios { + 4:3 { + title = ratio 4/3 + value = 1.3333333 + } + } + } + } + + +Impact +====== + +It is not possible to change or override cropVariants via Page and User TSconfig. + +.. index:: Backend, FAL, TSConfig \ No newline at end of file -- GitLab