@php
use Illuminate\Support\Str;
$tamanhos = [
'sm' => 'max-w-sm',
'md' => 'max-w-md',
'lg' => 'max-w-lg',
'xl' => 'max-w-xl',
'2xl' => 'max-w-2xl',
'3xl' => 'max-w-3xl',
'4xl' => 'max-w-4xl',
'full' => 'max-w-full',
];
$classeLargura = $tamanhos[$largura] ?? 'max-w-lg';
// Detecta se é arquivo de storage ou direto da public
$isStorage = Str::startsWith($arte, ['anexos/', 'uploads/', 'storage/']);
if (Str::startsWith($arte, ['http://', 'https://'])) {
// URL externa
$artePath = $arte;
} elseif (Str::startsWith($arte, 'storage/')) {
// Já vem pronto (public/storage/arquivo.png)
$artePath = asset($arte);
} elseif (Str::startsWith($arte, 'public/')) {
// Vem com "public/anexos/arquivo.png" → transforma em "storage/anexos/arquivo.png"
$artePath = asset('storage/' . Str::after($arte, 'public/'));
} else {
// Caso padrão: "anexos/arquivo.png" (armazenado via Storage::put em 'public')
$artePath = asset('storage/' . $arte);
}
@endphp
@if (Str::endsWith(strtolower($arte), ['.jpg', '.jpeg', '.png', '.gif', '.webp']))

@elseif(Str::endsWith(strtolower($arte), '.pdf'))
@else
Formato não suportado para exibição.
@endif