Select Image path from files field without "- >"

Good morning.

I have another question to this lovely community.
I have an image field like this:

label: Produktbild
type: files
headline: Bild
uploads: false
max: 1
multiple: false
query: site.find('mediathek').children.find('produkte').images
layout: cards
size: medium

When i select the image the image path is written in the txt like:

- > mediathek/produkte/product-image.jpg

To read the image path from the data array in the writeContent Method i have to write:

$imagePath =  image(trim(trim($data['image_path'], '- >')))->name();

Is there a simpler way to get rid of the “- >” in Kirby than to trim() it?

For a single file, you can call the toFile() method on the field, e.g.

if ($image = $page->cover()->toFile()) {
  echo $image->name();
}

Replace with your field name which you left out from your blueprint snippet. To me, it’s not clear where $data comes from…