Can't get Images or Image on a user page from the user account

I found this post that should solve the problem, but I am not sure that increasing the memory is the
the goal.

I can also prohibit to upload large files in this case.

Multiple images:
For testing I took very small images now. The error is a different one:
What is happening now is that the page takes forever to load until the timeout hits.
This is only happening with the array of images.

So could it be, that

'bilder' => ($bilder = $user->bilder()) ? Data::encode($bilder->id(), 'yaml') : null,

which should deliver an array of images, need a different encoding here?

Single images:
With a single image “avatar” it also does not work as I expaced it.

When I call the avatar like this:

<?= $page->avatar()->toFile()->url()?>

in the template, after I encode it in the model like this:

'avatar' => ($avatar = $user->avatar()) ? Data::encode($avatar->id(), 'yaml') : null,

the outcome is null even if the account has an avatar. Looks like I am still doing stuff wrong here…