Virtual Page (image: Tag) wrong url

When using a virtual page and adding (image: ) inside e.g. textarea field and output it via kt() in my template, it seems the URL from the image is starting from the root url instead of the parent (not virtual) page.

 return new Page([
                                'slug' => $page->uri().DS.$id, // $id is defined in the route
                                'parent' => $page,
                                'template' => 'landingvirtual-page',
                                'content' => [
                                  'text' => $text,
                                ]
                              ]);

can that be fixed from within the route/virtual new page generation?

Have you uploaded the image via kirby panel to the virtual page?

If so, take a look here for a full exmaple Merging content sources | Kirby CMS

I think you are missing the files option

 return new Page([
'slug' => $page->uri().DS.$id, // $id is defined in the route
'parent' => $page,
'template' => 'landingvirtual-page',
'files'    => $page ? $page->files()->toArray() : null,
'content' => [
 'text' => $text,
  ]
 ]);

You say the images are on the parent, not virtual page though? may need to do this instead

'files'    => $page ? $page->parent()->files()->toArray() : null,

thanks for the idea,

however it seems to throw errors saying “file not found” instead of having the link wrong

what do you get back if you do this in the landingvirtual-page template

dump($page->files());

the files not found error is due to at another modification where i overwrite the image tag.

thanks