index-main/site/snippets/picture.php
isUnknown ac2ccf01e2
Some checks failed
Deploy / Deploy to Production (push) Failing after 6s
remove gitlab ci, add forgejo ci
2026-01-05 11:10:44 +01:00

33 lines
1.1 KiB
PHP

<?php if (isset($file)): ?>
<?php
$sizes = isset($size) ? '(min-width: 1085px) ' . $size . 'vw, 100vw' : '(min-width: 1085px) 50vw, 100vw';
$alt = $file->alt() ?? '';
$crop = $crop ?? false;
$webPSrcset = $file->srcset('webp');
$srcset = $file->srcset();
$src = $file->url();
$width = $file->resize(1800)->width();
$height = $file->resize(1800)->height();
$class = isset($class) ? 'class="' . $class . '"': '';
$lazy = $lazy ?? true;
$span = isset($span) ? 'style="--span: ' . $span . ';"': '';
?>
<picture <?= $class ?> <?= $span ?> data-id="<?= $file->uuid() ?>" orientation="<?= $file->orientation() ?>">
<source srcset="<?= $webPSrcset ?>"
sizes="<?= $sizes ?>" type="image/webp">
<img
src="<?= $src ?>"
srcset="<?= $srcset ?>"
sizes="<?= $sizes ?>"
width="<?= $width ?>"
height="<?= $height ?>"
alt="<?= $alt?>"
>
<div class="loader"></div>
</picture>
<?php endif ?>