Single file from site.txt to template

sorry i am just new and learning:
in the blueprint i have this:
type: files
label: Favicon
max: 1
template: image-favicon

Now i am triying to get this in to the template, like this, but the output of the image is, see below

<?php if ($cover = $site->metafavicon()): ?> <?= $cover->crop(1200, 600) ?> <?php endif ?>


  • >

see the strange →
i think i miss something but iam not sure what?
thanks i advance

Hey, welcome to our forum.

You have to convert the field value to a file object via the toFile() method:

<?php if ($cover = $site->metafavicon()->toFile()): ?> 
  <?= $cover->crop(1200, 600) ?> 
<?php endif ?> 
1 Like

o yes, and so fast, thank you many times! love the kirby system!

1 Like