@props([ 'src', 'alt' => '', 'width' => null, 'height' => null, 'class' => '', 'sizes' => '100vw', 'srcset' => null, 'loading' => 'lazy', 'decoding' => 'async' ]) @php $isExternal = str_starts_with($src, 'http'); $imageUrl = $isExternal ? $src : asset($src); // Generate WebP URL $webpUrl = preg_replace('/\.(jpg|jpeg|png|gif)$/i', '.webp', $imageUrl); $hasWebP = !$isExternal && preg_match('/\.(jpg|jpeg|png|gif)$/i', $src); @endphp @if($hasWebP) {{ $alt }} @else {{ $alt }} @endif