@props(['path' => null, 'alt' => '', 'class' => 'object-cover w-full h-40', 'placeholder' => '/images/placeholder.svg']) @php $url = null; try { if ($path) { // URL externe (ex: googleusercontent) => servir directement if (preg_match('/^https?:\/\//i', $path)) { $url = $path; } else { // Chemin storage local $cleanPath = str_replace(['\\', '//'], '/', trim($path, '/\\')); if (\Illuminate\Support\Facades\Storage::disk('public')->exists($cleanPath)) { $url = \Illuminate\Support\Facades\Storage::url($cleanPath); } } } } catch (\Exception $e) { $url = null; } $finalSrc = $url ?? asset($placeholder); @endphp {{ $alt }}merge(['class' => $class]) }} onerror="this.onerror=null;this.src='{{ asset($placeholder) }}'" loading="lazy" />