Files
SkinbaseNova/resources/views/components/avatar.blade.php
2026-02-17 17:14:43 +01:00

11 lines
477 B
PHP

@php
// Usage: <x-avatar :user="$user" size="128" />
$size = $size ?? 128;
$profile = $user->profile ?? null;
$hash = $profile->avatar_hash ?? null;
$src = \App\Support\AvatarUrl::forUser((int) $user->id, $hash, (int) $size);
$alt = $alt ?? ($user->username ?? 'avatar');
$class = $class ?? 'rounded-full';
@endphp
<img src="{{ $src }}" alt="{{ $alt }}" loading="lazy" decoding="async" class="{{ $class }}" width="{{ $size }}" height="{{ $size }}">