@props([ 'src', 'alt' => '', 'class' => '', 'loading' => null, 'fetchpriority' => null, 'width' => null, 'height' => null, ]) @php $webpSrc = preg_replace('/\.(png|jpe?g)$/i', '.webp', $src); $webpPath = public_path(ltrim(parse_url($webpSrc, PHP_URL_PATH) ?: $webpSrc, '/')); $hasWebp = is_file($webpPath); @endphp @if($hasWebp) {{ $alt }}except(['src', 'alt', 'class', 'loading', 'fetchpriority', 'width', 'height']) }} > @else {{ $alt }}except(['src', 'alt', 'class', 'loading', 'fetchpriority', 'width', 'height']) }} > @endif