typo3 fluid: set a link to media image

Using f:image is not enough because if there is a link defined in the backend, like this:

bild

that link is, of course, ignored. Let’s say I have an extbase entity named “course” and it has exactly 1 image named “image”. If there is a link, I can access it via

{course.image.originalResource.link}

But using this wont suffice, because if a target is defined, it is no longer usable. That’s why its advised to use fluids link.typolink, like this:

<f:link.typolink parameter="{course.image.originalResource.link}">
 <f:image image="{course.image}/>
</f:link.typolink>

and that works!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.