Why do I have a dash in content image names?

When I have a images using this yaml.

        label: Hero Image
        type: files
        multiple: false
        required: yes
        layout: cards
        size: small

It saves as:


- 5c65b7f9429803533b58195a_61905.jpeg


So when I try to output it the image fails.

<?php if($image = $page->hero_image()): ?>
<img src="<?= $image->url() ?>" alt="">
<?php endif ?>

I get this:

<img src="- 5c65b7f9429803533b58195a_61905.jpeg" alt="">

What is the dash? It should be:

<img src="5c65b7f9429803533b58195a_61905.jpeg" alt="">

Another image has - >


- >


What is going on?

The files field stores content in yaml_format, you can fetch images like this:

Single image:

<?php if ($image = $page->hero_image()->toFile()): ?>
<img src="<?= $image->url() ?>" alt="">
<?php endif ?>

Multiple images:

<?php foreach ($page->hero_image()->toFiles() as $image): ?>
<img src="<?= $image->url() ?>" alt="">
<?php endforeach ?>

That happens if the string is very long. Nothing to worry about.

Perfect/. Thanks!