Upload beautify
This commit is contained in:
12
resources/views/components/avatar.blade.php
Normal file
12
resources/views/components/avatar.blade.php
Normal file
@@ -0,0 +1,12 @@
|
||||
@php
|
||||
// Usage: <x-avatar :user="$user" size="128" />
|
||||
$size = $size ?? 128;
|
||||
$profile = $user->profile ?? null;
|
||||
$hash = $profile->avatar_hash ?? null;
|
||||
$src = $hash
|
||||
? asset("storage/avatars/{$user->id}/{$size}.webp?v={$hash}")
|
||||
: asset('img/default-avatar.webp');
|
||||
$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 }}">
|
||||
Reference in New Issue
Block a user