How to readout an image in a Fluid template and give it a click enlarge function in DCE typo3 + FAL

How to wrap image with link in DCE + FAL

For set link around image with same resource you have to use “<f:uri.image>” following example will help you more.

Your fluid template gets an array of FileCollection models,

Following example will show you how to output several images from the FileCollection and wrap with link with same image resource

TCA Configuration for FAL – File Abstraction Layer

    <foreign_types type="array">
        <numIndex index="2">






Template content (fluid)

<f:for each="{dce:fal(field:'gallery', contentObject:contentObject)}" as="fileReference" iteration="iterator" >
   <a href='<f:uri.image src="{fileReference.uid}" treatIdAsReference="1" />'  rel="gallery" title="" class="fancybox" >
       <f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" class="icon" />

The loop run through the complete FAL image list.

The if condition in the treatIdAsReference is recommended because FileCollections returns different types of objects depending of the type of the collection.

Folder based collections returns the file directly, static based collections a file reference. With this condition both cases are covered.

This was for FAL – File Abstraction Layer.

Now we look for simple upload image [ Systems file collections ]

If you have use file collections and you have defined a field in DCE where you can select images than you can access the file name in the Fluid template.

The location where the image is stored is also defined in the TCA, which is mostly something like uploads/pics.

TCA Configuration for simple file upload


Note : Since version 0.11.x of DCE you are. Just add a group field, set allowed tablename to “sys_file_collection” and add the dce_load_schema option.

In the Fluid template you can write following script:

<a href="{f:uri.image(src:'uploads/pics/{field.yourPicture}')}" >
    <f:image src="uploads/pics/{field.yourPicture}" alt="" maxWidth="150" maxHeight="150" />

I hope this will work for you 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya