简体   繁体   中英

How to get cropped image dimensions in a Fluid template in Typo3 v8

Is there a way to get the actual image size (width/height) of a cropped image ("Image manipulation" > [Open Editor]) in a fluid template ?

All I can come up with is {image.properties} and width and height . But these are the dimensions of the original resource, not the cropped one. And there is of course an attribute crop which holds all the crop info:

{"default":{"cropArea":{"height":0.6431784107946027,"width":0.608,"x":0.037,"y":0.15592203898050974},"selectedRatio":"NaN","focusArea":null}}

But do I really have to find a way to parse this in fluid (if that's even possible)? Isn't there an official way to calculate the actual dimension of a generated image?

My use case is an image gallery component for which I need to explicitly state the image dimensions.

In TYPO3 Fluid, You can crop image like below. See here

<f:image src="{image ogject}" alt="Landscape" width="100c" height="100c" />

您可以使用 VHS Media / SizeViewHelper https://fluidtypo3.org/viewhelpers/vhs/master/Media/SizeViewHelper.html

<f:format.bytes><v:media.size path="{f:uri.image(image: mediaElement, width: 600) -> v:format.trim(characters: '/')}" /></f:format.bytes>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM