Urs
Urs

Reputation: 5122

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?

Upvotes: 2

Views: 4259

Answers (1)

minifranske
minifranske

Reputation: 1315

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')}"/>

Upvotes: 3

Related Questions