Reputation: 618
Since TYPO3 8.7 has a nice cropVariants option for responsive images, I wonder how to best implement this:
In an example on stackoverflow documentation 'image-cropping-typo3-8-7-lts' (not allowed to link it) some tsconfig is made to enable cropping variants.
Then it will be available for all images in the content elements, how to best adjust the fluid styled content templates?
For example fluid_styled_content/Resources/Private/Partials/Media/Type/Image.html points to fluid_styled_content/Resources/Private/Partials/Media/Rendering/Image.html, which contains
<f:media class="image-embed-item" file="{file}" width="{dimensions.width}" height="{dimensions.height}" alt="{file.alternative}" title="{file.title}" />
Does anyone has an example how to replace this particular part? Or is it possible to allow cropping variants only for a custom content element?
Upvotes: 2
Views: 1579
Reputation: 45
You have to add you CropVariant as attribute in your image viewhelper - with f:media it don't work i think...
e. g.:
<f:image src="{uid}" treatIdAsReference="1" cropVariant="smartphone" maxWidth="{imagemaxwidth}" maxHeight="{imagemaxheight}" />
Upvotes: 3