Img url not showing in snippet though dumps shows the data

Hi folks,

I’m running into a really weird behaviour and could use a second pair of eyes.
Within a page I’m looping through different sections using kind of the same snippet:

<?php snippet('snippet',array('data'=> $pagedata)); ?>

The called snippet contains the following code:

   <?php foreach($data->additionalbox()->toStructure() as $slide): ?>
      <?php // dump($slide) /* did this and shows all data as supposed */ ?>
      <?php if($slide->img()->isNotEmpty() && $img = $data->file($slide->img())) echo $img->url()  ?>
    <?php endforeach ?>

This outputs everything but the images url on the third slider though they are shown when I do a dump. The images are all svg btw. Now, the same code does output before and afterwards other images, jpgs and svg’s alike. I’m simply at loss what to look for anymore. I would gladly welcome any ideas…


What happens if you try to call the Url of that image in a standard template (without any structure field)

if($img) { echo $img->url(); }

the image doesn’t show. but I can see in the browser and select it in the backend.

Mhm, is the file somehow corrupted, maybe?

just came into my mind as well. will go through them and get back to you on that. thx so far

found it. they weren’t in the folder.
in the yaml file i had the following declared:

    label: Icons & Texte
    type:  structure
    style: table
    snippet: fields/snippetfield
        label: Bild
        type: image
        label: Headline
        type:  textarea
        buttons: false
        label: Text
        type: textarea

I wrongly assumed that by declaring type:image I would only get the directories images and not the entire website’s images.

@texnixe is there a way to only get the actual directory’s images?

Hm, the image field only shows the current folder’s images as options? Don’t know why it should behave differently in your case?

Turns out Kirby works the way it is supposed to. I just remembered I’ve moved the files at some point. Thx for your eyes & thoughts @texnixe!