I can't call an image uploaded from Twig

The scenario is the following: I want to make a list of members of a website that will be displayed in the footer. Each member has a name, a title, and an image, which is uploaded from Grav to a destination folder inside /user/images/team.

Well, I DON’T KNOW HOW TO CALL that image within the For loop that I make for each member. This is what I have so far.

Theme YAML code:

team:
   -
     name: Pedro
     description: 'Web developer'
     image:
       user/images/team/60596353.png:
         name: 60596353.png
         full_path: 60596353.png
         type: image/png
         size: 36463
         path: user/images/team/60596353.png

Twig code:

{% if theme_config.team is not empty %}
     <div class="team">
         {% for item in theme_config.team %}
         {% set member_image = item.image %}
         {% set member_file = (member_image|first).name %}
         <article>
            
             <span class="image"><img src="{{ url('user://images/team' ~ member_file) }}" alt=""></span>
             <p>
                 <strong class="name">{{ item.name }}</strong>
                 <span class="title">{{ item.description|raw }}</span>
             </p>
         </article>
         {% endfor %}
     </div>
     {% endif %}

The HTML output shows:

<span class="image"><img src="" alt=""></span>

Where this error?. Why can’t I call that image the same way I call, for example, the website logo?

Looks like you are missing a slash there.

1 Like

Thanks @hughbris for your answer. Finally it was nonsense, and you are right in that slash. Good observation

Thank you so much

1 Like