Tailor - display multiple items from fileupload

Hi there!
I hope this question isn’t too simple to ask, but I am just starting out and can’t find the right syntax.

I added a ‘fileupload’ field to my Tailor stream blueprint.

extra_images:
        label: Sketches, perspectives, etc.
        type: fileupload
        mode: image

In there I want to upload multiple images to a post, which then shall be displayed as a list of images.

Uploading the images works fine, but I can’t figure out how to access them.

If the fileupload is limited to only one image, I can simply add it with:

<img src="{{ post.extra_images.path }}">

But what if the fileupload isn’t limited to one image only and I want it to output as many <img> as available in ‘extra_images’?

Would be cool if someone could share the solution for that with me.

Thanks a lot and have a great day. ^^

you’ll need to create a loop to iterate over all the images in twig. Here’s an example:


{% for image in post.extra_images %}
    <img src="{{ image|media }}">
{% endfor %}

Also note the |media filter. It’s a helper filter that references the media folder in the application.

hope this helps!

1 Like

Thank you so much! Now I understood how it works. :smile:

1 Like