@props([ 'src', // Stoic filename string e.g. "hero.png" 'preset' => 'medium', // which preset sets the src + default sizes hint 'alt' => '', 'loading' => 'lazy', 'fetchpriority' => 'auto', 'sizes' => null, // override when you know the render context 'width' => null, 'height' => null, 'preload' => false, // push a into
for LCP images ]) @php $ext = strtolower(pathinfo($src, PATHINFO_EXTENSION)); $imageSrc = \App\Services\Stoic::image($src, $preset); $srcset = \App\Services\Stoic::srcset($src); $presetW = collect(\App\Services\Stoic::presets())->firstWhere('code', $preset)['width'] ?? 800; $sizesAttr = $sizes ?? "(min-width: 1024px) {$presetW}px, 100vw"; [$width, $height] = $width !== null && $height !== null ? [$width, $height] : \App\Services\Stoic::dimensions($src, $preset); @endphp @if($preload) @push('seo') @endpush @endif