2

There's an awesome feature in TYPO3 8.7 called cropping variants in image manipulation tool. Details informations can be found in official feature description #75880. Thanks to this we can allow back-end user to crop one image in multiple variants, for exampple: for mobile and desktop. See image below.

enter image description here Image from: https://techblog.sitegeist.de/responsive-images-with-typo3-8-7/

Configuration can be done in TCA:

'config' => [
 'type' => 'imageManipulation',
 'cropVariants' => [
     'mobile' => [
         'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.mobile',
         'allowedAspectRatios' => [
             '4:3' => [
                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                 'value' => 4 / 3
             ],
             'NaN' => [
                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                 'value' => 0.0
             ],
         ],
     ],
     'desktop' => [
         'title' => 'LLL:EXT:ext_key/Resources/Private/Language/locallang.xlf:imageManipulation.desktop',
         'allowedAspectRatios' => [
             '4:3' => [
                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.4_3',
                 'value' => 4 / 3
             ],
             'NaN' => [
                 'title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_wizards.xlf:imwizard.ratio.free',
                 'value' => 0.0
             ],
         ],
     ],
 ]

]

I'm trying to integrate it into tx_news. I want to use existing field called fal_media. The configuration of this field you can find in the source file of tx_news in GitHub. Screenshot of the code snippet below:

enter image description here

Somebody have an idea how cropping variants in image manipulation can be implemented in tx_news extension for field fal_media?

explorer
  • 165
  • 1
  • 9

2 Answers2

2

Just to anwer this question and make it easy to find the solution (georgs link pointing to it)

$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_media']['config']['overrideChildTca']['columns']['crop'] = [
    'config' => [
        'cropVariants' => [
            'mobile' => [
                'title' => 'Mobile',
                'allowedAspectRatios' => [
                    '4:3' => [
                        'title' => '4 zu 3',
                        'value' => 4 / 3
                    ],
                    'NaN' => [
                        'title' => 'FREI',
                        'value' => 0.0
                    ],
                ],
            ],
        ],
    ],
];

See: https://github.com/georgringer/news/issues/371

Tobias Gaertner
  • 1,155
  • 12
  • 30
0

simply add cropVariant="mobile" to your f:image.

BENCH
  • 1
  • 1
  • Question is how to adjust TCA of `fal_media` in `tx_news` extension. So we can add different variants (and settings) for this particular field, when editing image in manipulation tool. Adding `cropVariant="mobile"` to f:image, somewhere in Templates won't affect manipulation tool.. that's just a presentation layer. – explorer Jul 07 '17 at 07:30