简体   繁体   中英

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:

<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 .

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.

Is there a way to prevent f:image from outputting with and height in the source tag? Probably not, if I look at the VH ?

You need to escape the width and height when adding 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')}"/>

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