31 lines
No EOL
972 B
PHP
31 lines
No EOL
972 B
PHP
<?php
|
|
|
|
$sizes = '(min-width: 1200px) 25vw, (min-width: 900px) 33vw, (min-width: 600px) 50vw, 100vw';
|
|
$alt = $file->alt();
|
|
$crop = $crop ?? false;
|
|
|
|
$webPSrcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset('webp') : $file->srcset('webp');
|
|
$srcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset() : $file->srcset();
|
|
$src = $crop === 'banner' ? $file->crop(1600, 800)->url() : $file->url();
|
|
$width = $crop === 'banner' ? $file->crop(1600, 800)->width() : $file->resize(1800)->width();
|
|
$height = $crop === 'banner' ? $file->crop(1600, 800)->height() : $file->resize(1800)->height();
|
|
|
|
?>
|
|
|
|
|
|
|
|
<picture>
|
|
|
|
<source srcset="<?= $webPSrcset ?>"
|
|
sizes="<?= $sizes ?>" type="image/webp">
|
|
<img
|
|
src="<?= $src ?>"
|
|
srcset="<?= $srcset ?>"
|
|
sizes="<?= $sizes ?>"
|
|
width="<?= $width ?>"
|
|
height="<?= $height ?>"
|
|
alt="<?= $alt?>"
|
|
loading="lazy"
|
|
>
|
|
<?= svg('assets/images/loader.svg') ?>
|
|
</picture>
|