简体   繁体   English

TYPO3流体f:没有宽度/高度属性的图像/ f:uri.image问题

[英]TYPO3 fluid f:image without width/height attribute / f:uri.image issues

I'm having some trouble getting {f:uri.image} to work, this doesn't render: 我在使{f:uri.image}工作时遇到了一些麻烦,这不会呈现:

<img src="{f:uri.image(src:person.firstImage,treatIdAsReference:1, width:150c,height:150c,cropVariant:'square')}"/>

person.firstImage is of type TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference . person.firstImage的类型为TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference

Maybe you spot the error? 也许你发现了这个错误?

On the other hand, this works: 另一方面,这工作:

<f:image class="image-author" image="{person.firstImage}" width="150c" height="150c" cropVariant="square"/>

... but then the output will always feature the width="150" height="150" html attributes, which will conflict with responsive CSS. ...但是输出将始终具有width="150" height="150" html属性,这将与响应式CSS冲突。

Is there a way to prevent f:image from outputting with and height in the source tag? 有没有办法阻止f:image在源标签中输出和高度? Probably not, if I look at the VH ? 可能不是,如果我看看VH

You need to escape the width and height when adding c 添加c时需要跳过宽度和高度

<img src="{f:uri.image(src:person.firstImage,treatIdAsReference:1, width:'150c',height:'150c',cropVariant:'square')}"/>

Would also go for: 也会去:

<img src="{f:uri.image(image:person.firstImage,width:'150c',height:'150c',cropVariant:'square')}"/>

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

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