Fix object fitting for images
This commit is contained in:
@@ -26,7 +26,6 @@ if ($block->location()->value() === 'web') {
|
|||||||
?>
|
?>
|
||||||
<?php if ($src): ?>
|
<?php if ($src): ?>
|
||||||
<figure>
|
<figure>
|
||||||
|
|
||||||
<?php snippet('image', [
|
<?php snippet('image', [
|
||||||
'alt' => $alt,
|
'alt' => $alt,
|
||||||
'contain' => $block->crop()->isFalse(),
|
'contain' => $block->crop()->isFalse(),
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$attrs = attr([
|
$attrs = attr([
|
||||||
'data-contain' => $contain ?? false,
|
|
||||||
'data-lightbox' => $lightbox ?? false,
|
'data-lightbox' => $lightbox ?? false,
|
||||||
'href' => $href ?? $src,
|
'href' => $href ?? $src,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<a <?= $attrs ?>>
|
<a <?= $attrs ?>>
|
||||||
<img src="<?= esc($src, 'attr') ?>" alt="<?= esc($alt, 'attr') ?>" style="aspect-ratio: <?= $ratio ?? 'auto' ?>">
|
<img
|
||||||
|
src="<?= esc($src, 'attr') ?>"
|
||||||
|
alt="<?= esc($alt, 'attr') ?>"
|
||||||
|
style="
|
||||||
|
aspect-ratio: <?= $ratio ?? 'auto' ?>;
|
||||||
|
object-fit: <?= ($contain ?? false) ? 'contain' : 'cover' ?>
|
||||||
|
"
|
||||||
|
>
|
||||||
</a>
|
</a>
|
||||||
|
Reference in New Issue
Block a user