@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, ]) @php $srcset = \Modules\Core\Stoic\Stoic::srcset($src); $presetW = collect(\Modules\Core\Stoic\Stoic::presets())->firstWhere('code', $preset)['width'] ?? 800; $sizesAttr = $sizes ?? "(min-width: 1024px) {$presetW}px, 100vw"; [$width, $height] = $width !== null && $height !== null ? [$width, $height] : \Modules\Core\Stoic\Stoic::dimensions($src, $preset); @endphp {{ $alt }}