Display user avatar with ImageColumn

I want to display the avatar for my users. I added HasAvatars to the User model and all but ImageColumn::make('avatar_url') returns nothing. It's supposed to return the generated ui-avatars if the avatar_url is null right ? I'm lost.
3 Replies
fh32000
fh3200015mo ago
same ImageColumn not suport Image url only from disk Tables\Columns\ImageColumn::make('anyNameNotExistInMode') ->label('Image')->defaultImageUrl( function ($record) { return $record->meta->image_url ?? "https://me.net/default.png"; }) this work for me
Diogo Pinto
Diogo Pinto15mo ago
This is how I do it with Infolists
Infolists\Components\ImageEntry::make('avatar')
->label('')
->getStateUsing(fn ($record) => Filament::getUserAvatarUrl($record))
->circular(),
Infolists\Components\ImageEntry::make('avatar')
->label('')
->getStateUsing(fn ($record) => Filament::getUserAvatarUrl($record))
->circular(),
Sorry, I posted Infolists above. Here's how I do it with TableColumns:
Tables\Columns\ImageColumn::make('avatar')
->circular()
->label('')
->getStateUsing(fn ($record) => Filament::getUserAvatarUrl($record)),
Tables\Columns\ImageColumn::make('avatar')
->circular()
->label('')
->getStateUsing(fn ($record) => Filament::getUserAvatarUrl($record)),
`
charleswilfriedk
charleswilfriedkOP15mo ago
Thx it's working!
Want results from more Discord servers?
Add your server