简体   繁体   English

如何在 Typo3 v8 的 Fluid 模板中获得裁剪的图像尺寸

[英]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 .我能想到的只有{image.properties}widthheight 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:当然还有一个属性crop包含所有的crop信息:

{"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.在 TYPO3 Fluid 中,您可以裁剪图像,如下所示。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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