How to reference images in content folder

I have added an image into the folder /content/home and I would like to reference this in home.txt in the same folder. Is this the best way to store and reference images using kirby?

HTML (./site/templates/home.php)
<div class="row" style="background-image:url(<?php echo $page->HeroBackground() ?>)">

    type: files
    headline: Cover Image
    max: 1
    template: cover

HeroBackground: ./img.jpg
HeroBackground: img.jpg

Use just the filename for files in the same folder.

can this image then be changed in the backend? Is it dynamic?

@pixelijn I am getting this error now: GET http://localhost/img.jpg 404 (Not Found)

I have updated the question with more code.

You have to create a file object from the field value first useing thetoFile() page method.

Note that if you want to use a files field in the Panel, you have to store your files in yaml format in the content file.

thanks for the help, do you have some example code, i do not understand what you mean?

For a single file:

For multiple files:

  - monster-trees-in-the-fog.jpg
  - monster-trees-in-the-rain.jpg
  - monster-trees-in-the-sun.jpg