[FEATURE] Allow overriding of image manipulation cropVariants 76/51676/3
authorStefan Froemken <froemken@gmail.com>
Tue, 14 Feb 2017 15:56:56 +0000 (16:56 +0100)
committerHelmut Hummel <typo3@helhum.io>
Thu, 23 Feb 2017 15:03:35 +0000 (16:03 +0100)
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>
typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
typo3/sysext/core/Classes/Imaging/ImageManipulation/Area.php
typo3/sysext/core/Classes/Imaging/ImageManipulation/Ratio.php
typo3/sysext/core/Documentation/Changelog/master/Feature-79812-AllowOverridingCropVariantsForImageManipulation.rst [new file with mode: 0644]

index aa1edcc..d46d417 100644 (file)
@@ -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']
     ];
 
     /**
index 0c1a632..7b96db8 100644 (file)
@@ -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);
index d13b41b..d8301cd 100644 (file)
@@ -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 (file)
index 0000000..f04679e
--- /dev/null
@@ -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