Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tfeuerst/7484f814a04ec7d6610a5f613799c893 to your computer and use it in GitHub Desktop.
Save tfeuerst/7484f814a04ec7d6610a5f613799c893 to your computer and use it in GitHub Desktop.
<?php
defined('TYPO3_MODE') || die();
/***************
* Add crop variants
*/
$defaultCropSettings = [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:format.default',
'allowedAspectRatios' => [
'16:9' => [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:ratio.16_9',
'value' => 16 / 9
],
'16:6' => [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:ratio.16_6',
'value' => 16 / 6
],
'16:4' => [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:ratio.16_4',
'value' => 16 / 4
],
'4:3' => [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:ratio.4_3',
'value' => 4 / 3
],
'1:1' => [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:ratio.1_1',
'value' => 1.0
],
'NaN' => [
'title' => 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:ratio.free',
'value' => 0.0
],
],
'selectedRatio' => 'NaN'
];
$largeCropSettings = $defaultCropSettings;
$largeCropSettings['title'] = 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:format.large';
$mediumCropSettings = $defaultCropSettings;
$mediumCropSettings['title'] = 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:format.medium';
$smallCropSettings = $defaultCropSettings;
$smallCropSettings['title'] = 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:format.small';
$extrasmallCropSettings = $defaultCropSettings;
$extrasmallCropSettings['title'] = 'LLL:EXT:renolit_modules/Resources/Private/Language/Backend.xlf:format.extrasmall';
/**
* cropVariants in use all over the project.
*/
$GLOBALS['TCA']['sys_file_reference']['columns']['crop']['config']['cropVariants'] = [
'default' => $defaultCropSettings,
'large' => $largeCropSettings,
'medium' => $mediumCropSettings,
'small' => $smallCropSettings,
'extrasmall' => $extrasmallCropSettings,
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment