TYPO3 v10 has reached end-of-life as of April 30th 2023 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
Crop variants configuration per content element¶
It is possible to provide a configuration per content element. If you want a different
cropping configuration for tt_content images, then you can add the following to
image field configuration of tt_content records:
'config' => [ 'overrideChildTca' => [ 'columns' => [ 'crop' => [ 'config' => [ 'cropVariants' => [ 'mobile' => [ 'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile', 'cropArea' => [ 'x' => 0.1, 'y' => 0.1, 'width' => 0.8, 'height' => 0.8, ], ], ], ], ], ], ], ]
Please note, you need to specify the target column name as array key. Most of the time this will be
as this is the default field name for image manipulation in
It is also possible to set the cropping configuration only for a specific tt_content element type by using the
$GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config'] = [ 'cropVariants' => [ 'default' => [ 'disabled' => true, ], 'mobile' => [ 'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile', 'cropArea' => [ 'x' => 0.1, 'y' => 0.1, 'width' => 0.8, 'height' => 0.8, ], 'allowedAspectRatios' => [ '4:3' => [ 'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3', 'value' => 4 / 3 ], 'NaN' => [ 'title' => 'LLL:EXT:core/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free', 'value' => 0.0 ], ], ], ], ];
Disable crop variants¶
Please note, as the array for
overrideChildTca is merged with the child TCA, so are the crop variants that are defined
in the child TCA (most likely sys_file_reference). Because you cannot remove crop variants easily, it is possible to disable them
for certain field types by setting the array key for a crop variant
disabled to the value
true as you can see in the
example above for the default variant.