Files are losing their infos when sending them in an array via Page::factory() form user to page

Hey.

I have users and in them there are images stored.
To use them on a virtual page I send them in a Page::factory() as an array to the page.

...
return Page::factory([
  'slug' => $slug,
  'template' => 'mitglied',
  'files' =>  $user->files()->toArray(),
  'content' => array_merge($user->content()->toArray(), $content)
]);
} 

in the Template dumping the images:

<?php dump($page->images()->first() )?> 

Kirby\Cms\File Object
(
[dimensions] => Array
    (
        [width] => 0
        [height] => 0
        [ratio] => 0
        [orientation] => 
    )

Somehow these infos get lost in the transport to the virtual page. Do I need to send them separated to the virtual page?

Where is that virtual page defined?

in a file site/routes/mitglied.php

<?php

use Kirby\Cms\Page;
use Kirby\Toolkit\Str;

 return [
  'pattern' => 'mitglieder/(:any)',
  'action' => function($slug) {
    $user = kirby()
      ->users()
      ->filter(function($user) use ($slug) {
        $isUser = Str::slug($user->name()) === $slug;
        $isPublic = $user->content()->public()->toBool();
        return $isUser && $isPublic;
      })
      ->first();

    if (!$user ) {
      return page("mitglieder/$slug");
    }

    $content = [
      'title' => $user->name(),
      'email' => $user->email(),
      'user' => $user,
    ];

    return Page::factory([
      'slug' => $slug,
      'template' => 'mitglied',
      'files' =>  $user->files()->toArray(), 
      'content' => array_merge($user->content()->toArray(), $content)
    ]);
  } 
];

But actually it would be in config:

$routes = array_map(
  fn($file) => include $file,
  glob(dirname(__DIR__) . "/routes/*.php")
);

I think the problem is the same as here: Virtual files | Kirby CMS

Oh. But the files are not really virtual… They are existing in the user.

But from the perspective of the page, they are virtual files, because they don’t belong to the current page. At least that’s what I think.

Interesting. I will give it a try.