@props([ 'path', 'alt', 'sizes' => '(max-width: 768px) 100vw, 960px', 'loading' => 'lazy', 'fetchpriority' => null, 'width' => null, 'height' => null, 'disk' => null, 'class' => null, ]) @php use App\Support\PublicImageUploadRules; use App\Support\ResponsiveImage; use Illuminate\Support\Facades\Storage; $diskName = $disk ?? PublicImageUploadRules::disk(); $filesystem = Storage::disk($diskName); $src = $filesystem->url($path); $variants = ResponsiveImage::availableVariants($path, $diskName); $srcset = collect($variants) ->map(fn (array $variant): string => $filesystem->url($variant['path']).' '.$variant['width'].'w') ->implode(', '); if ($srcset === '' && $filesystem->exists($path)) { $srcset = null; } $dimensions = ($width === null || $height === null) ? ResponsiveImage::dimensions($path, $diskName) : null; $resolvedWidth = $width ?? $dimensions['width'] ?? null; $resolvedHeight = $height ?? $dimensions['height'] ?? null; $loadingValue = $loading; @endphp {{ $alt }}except(['path', 'alt', 'sizes', 'loading', 'width', 'height', 'disk', 'class']) }} >