Der File Abstraction Layer wird gerne von Redakteuren für die Bearbeitung von Bildern genutzt.
Oftmals passt das Bild jedoch nicht 1zu1 in das vorgesehene Bildkonzept. Durch die Definition von "Default-Ausschnitten" erleichtert man dem Redakteur, das ausgewählte Bild im richtigen Format auf der Seite darzustellen, ohne lange probieren oder es im Vorfeld bearbeiten zu müssen.
Hier ein Codebeispiel:
<?php
(function() use($_EXTKEY) {
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScripts', 'T2SiteTrafo2De');
\FluidTYPO3\Flux\Core::registerProviderExtensionKey('Trafo2.SiteTrafo2De', 'Page');
\FluidTYPO3\Flux\Core::registerProviderExtensionKey('Trafo2.SiteTrafo2De', 'Content');
/*************** * Add crop variants */
$defaultCropSettings = [
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:option.default',
'allowedAspectRatios' => [
'16:9' => [
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:format.16_9',
'value' => 16 / 9
],
'16:10' => [
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:format.16_10',
'value' => 16 / 10
],
'4:3' => [
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:format.4_3',
'value' => 4 / 3
],
'1:1' => [
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:format.1_1',
'value' => 1.0
],
'NaN' => [
'title' => 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:format.free',
'value' => 0.0
],
],
'selectedRatio' => 'NaN',
'cropArea' => [
'x' => 0.0,
'y' => 0.0,
'width' => 1.0,
'height' => 1.0,
]
];
$mediumCropSettings = $defaultCropSettings;
$mediumCropSettings['title'] = 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:option.medium';
$smallCropSettings = $defaultCropSettings;
$smallCropSettings['title'] = 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:option.small';
$extrasmallCropSettings = $defaultCropSettings;
$extrasmallCropSettings['title'] = 'LLL:EXT:'.$_EXTKEY.'/Resources/Private/Language/backend.xml:option.extrasmall';
$GLOBALS['TCA']['tt_content']['types']['image']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['default'] = $defaultCropSettings;
$GLOBALS['TCA']['tt_content']['types']['image']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['medium'] = $mediumCropSettings;
$GLOBALS['TCA']['tt_content']['types']['image']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['small'] = $smallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['image']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['extrasmall'] = $extrasmallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textpic']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['default'] = $defaultCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textpic']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['medium'] = $mediumCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textpic']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['small'] = $smallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textpic']['columnsOverrides']['image']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['extrasmall'] = $extrasmallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['media']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['default'] = $defaultCropSettings;
$GLOBALS['TCA']['tt_content']['types']['media']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['medium'] = $mediumCropSettings;
$GLOBALS['TCA']['tt_content']['types']['media']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['small'] = $smallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['media']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['extrasmall'] = $extrasmallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['default'] = $defaultCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['medium'] = $mediumCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['small'] = $smallCropSettings;
$GLOBALS['TCA']['tt_content']['types']['textmedia']['columnsOverrides']['assets']['config']['overrideChildTca']['columns']['crop']['config']['cropVariants']['extrasmall'] = $extrasmallCropSettings;
})();