Getting an image not in a page

I have an image saved and set in my site yaml config file:

gv:
  map_image:
    user/themes/site/assets/map.jpg:
      name: map.jpg
      type: image/jpeg
      size: 123514
      path: user/themes/site/assets/map.jpg

The image exists in the correct directory but I can’t get it to display in the page:

{% for item in site.gv.map_image %}
<img src="{{ page.media[item.name].cropZoom(1200,350).quality(100).url() }}" alt="">
{% endfor %}

If I run a test like this:

{% for item in site.gv.map_image %}
{{ item.name }} 
{% endfor %}

It outputs the name fine and any other var, it’s just not outputting the image in Grav’s image function thing. Is that because it’s not in the page and so the ‘page.media’ function isn’t working? I don’t really understand how it works…

Use page.media for the page’s media (contained in the page’s folder. In your case the image is in another folder, so you can’t use that syntax.

Use this instead.

Hi Flavio, I’m coming back to this to try and solve a problem - can you please have a look at this new post of mine which relates to this old question: https://getgrav.org/forum#!/general:pulling-an-image-from-a-fie