Printing Images from metaobject list

Printing Images from metaobject list

Rueben
Shopify Partner
5 0 0

Hi Everyone,

 

I have a shop where we collaborate with influencers and now I want to highlight these influencers even more. To do that I have created a metaobject called influencer with the fields: .name, .picture, .instagram and .gallery. I think every field speaks for itself, except gallery. In the gallery field I have enabled "lists of files" because I want to create a page for the influencer metaobject where I can print each image/file inside this .gallery. I have gotten as far as to creating the following code:

{% assign influencers = shop.metaobjects.influencer.values %}

{% for influencer in influencers %}
<h2>{{ influencer.name }}</h2>

{% assign gallery = influencer.gallery | split: ',' %}
{% for image in gallery %}
{% assign image_url = image | img_url: '500x' %}
<img src="{{ image_url }}" alt="{{ influencer.name }}">
{% endfor %}
{% endfor %}
It seems like this works, but instead of printing the images it prints "No image" as seen below.

Rueben_0-1718971155406.gif

Does anyone know why this is happening or what I'm doing wrong? Any help is greatly appreciated. I have been stuck on this for a week...

Replies 0 (0)