Typo3 - Fluid,Flexform hiding image results in "No file reference (sys_file_reference) was found for given UID"

1k views Asked by At

I`ve created a custom Extension, which uses

{f:uri.image(src: '{data.flexform_backgroundImages}', treatIdAsReference: '1')}

If I hide the image at the Backend, I receive the followind issue at the frontend: "No file reference (sys_file_reference) was found for given UID". How can I solve this?

1

There are 1 answers

5
Jo Hasenau On

Before using a variable you should check if it actually has got a value. To do so, put an f:if view helper around your f:uri.image view helper and use the same variable in the condition.

<f:if condition="{data.flexform_backgroundImages}">
    <img src="{f:uri.image(src: '{data.flexform_backgroundImages}', treatIdAsReference: '1')}" />
</f:if>