lundi 10 août 2020

How to show a random image from image array in Typo3 Fluid Template?

I have a field image with a array of image objects. User can upload some pictures in this field. In the fluid template it looks like:

<f:if condition="{field.image}">
    <f:then>
        <f:for each="{field.image}" as="image" iteration="iterator">
            <f:image src="file:{image.properties.uid}" alt="" class="img-fluid" width="1250c" height="600c" />
        </f:for>
    </f:then>
</f:if>

In case there are three pictures uploaded, all will be displayed. But I need to show only one random picture on this place. How can I do it?




Aucun commentaire:

Enregistrer un commentaire