Nechalon
03/23/2023, 11:10 AM$item->image('picture', 'desktop')), is this why is only displays that crop mode? I tried it with tablet and mobile but it still only displays the desktop version.Nechalon
03/23/2023, 11:32 AMNechalon
03/23/2023, 11:32 AMNechalon
03/23/2023, 11:33 AMifox
03/23/2023, 11:41 AMpreset sectionifox
03/23/2023, 11:50 AM<picture>
<source srcset="{{ $item->image('medias_field_name', 'crop_key', ['w' => 200] }} 200w, {{ $item->image('medias_field_name', 'crop_key', ['w' => 400] }} 400w, ...<as many width as you need depending on how large the image is rendering at in your frontend>" sizes="<media query defining when to use this source and a value defining how much of the viewport width this image takes eg. 50vw>">
<as many sources as you have crop keys>
<img tag with a placeholder image and width height attributes or a ratio box to avoid layout shifts>
</picture>ifox
03/23/2023, 11:58 AMNechalon
03/23/2023, 12:43 PM<picture class="figures col-12 col-md-{{ App\Helpers\Course::colCount(count($block->images('gallery', 'desktop'))) }} mb-4">
<source media="(max-width: 768px)" srcset="{{ $image['image_url']['mobile'] }}">
<source media="(min-width: 768px) and (max-width: 992px)" srcset="{{ $image['image_url']['tablet'] }}">
<source media="(min-width: 992px)" srcset="{{ $image['image_url']['desktop'] }}">
<img src="{{ $image['image_url']['desktop'] }}" class="img-fluid">
</picture>Nechalon
03/23/2023, 12:43 PM