## Default Image cropping ##
TCEFORM.sys_file_reference.crop.config.cropVariants {
default {
title = Desktop
selectedRatio = NaN
allowedAspectRatios {
NaN {
title = Free
value = 0.0
}
21:9 {
title = 21:9
value = 2.3333333
}
16:9 {
title = 16:9
value = 1.7777777
}
4:3 {
title = 4:3
value = 1.3333333
}
3:2 {
title = 3:2
value = 1.5
}
1:1 {
title = 1:1
value = 1
}
}
}
tablet {
title = Tablet
selectedRatio = NaN
allowedAspectRatios {
NaN {
title = Free
value = 0.0
}
21:9 {
title = 21:9
value = 2.3333333
}
16:9 {
title = 16:9
value = 1.7777777
}
4:3 {
title = 4:3
value = 1.3333333
}
3:2 {
title = 3:2
value = 1.5
}
1:1 {
title = 1:1
value = 1
}
}
}
mobile {
title = Mobile
selectedRatio = NaN
allowedAspectRatios {
NaN {
title = Free
value = 0.0
}
21:9 {
title = 21:9
value = 2.3333333
}
16:9 {
title = 16:9
value = 1.7777777
}
4:3 {
title = 4:3
value = 1.3333333
}
3:2 {
title = 3:2
value = 1.5
}
1:1 {
title = 1:1
value = 1
}
}
}
}
## Default Image cropping - END ##
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.
create a file your_extension/Configuration/TCA/Overrides/tx_news_domain_model_news.php
<?php
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_media']['config']['overrideChildTca']['columns']['crop'] = [
'config' => [
'cropVariants' => [
'default' => [
'disabled' => true,
],
'newsimage' => [
'title' => 'News Image',
'allowedAspectRatios' => [
'16:9' => [
'title' => 'News Image',
'value' => 16 / 9
],
],
'selectedRatio' => '16:9', // Optional: Standardmäßig ausgewähltes Seitenverhältnis
],
'teamimage' => [
'title' => 'Team Image',
'allowedAspectRatios' => [
'80:99' => [
'title' => 'Team Image',
'value' => 80 / 99
],
],
'selectedRatio' => '80:99', // Optional
],
],
],
];
# set specified crop variant in fluid-template:
<f:media class="img-fluid" cropVariant="newsimage" file="{newsItem.mediaPreviews.0}" title="{newsItem.mediaPreviews.0.originalResource.title}" alt="{newsItem.mediaPreviews.0.originalResource.alternative}" loading="{settings.list.media.image.lazyLoading}" width="{f:if(condition: settings.media.maxWidth, then: settings.media.maxWidth, else: settings.list.media.imageNews.width)}" height="{f:if(condition: settings.media.maxHeight, then: settings.media.maxHeight, else:'')}" />