Skip to content

Kirby 4.5.0

$user->avatar()

Returns the File object for the avatar or null

$user->avatar(): Kirby\Cms\File|null

Return type

Kirby\Cms\File|null

Parent class

Kirby\Cms\User

Example

<?php if($avatar = $kirby->user('bastian@example.com')->avatar()): ?>
<img src="<?= $avatar->url() ?>" alt="Bastian's avatar">
<?php endif ?>

Avatar storage

The user avatar is stored in the user account folder in /site/accounts..
Avatars can be jpg, gif or png files and must be called profile