fix picture problem
This commit is contained in:
parent
c65f5f228b
commit
c49aca969e
2 changed files with 6 additions and 2 deletions
|
|
@ -2,7 +2,10 @@
|
|||
<a class="event-card__link" href="<?= $event->url() ?>"></a>
|
||||
<div class="image-wrapper">
|
||||
<?php if ($event->gallery()->toFiles()->count() > 1): ?>
|
||||
<img class="image-cover" src="<?= $event->gallery()->toFiles()->first()->url() ?>" alt="">
|
||||
<?php snippet('picture', [
|
||||
'file' => $event->gallery()->toFiles()->first(),
|
||||
'class' => 'image-cover'
|
||||
]) ?>
|
||||
<?php endif ?>
|
||||
<?php
|
||||
$file = $event->gallery()->toFiles()->count() > 1 ? $event->gallery()->toFiles()->nth(1) : $event->gallery()->toFiles()->first();
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@
|
|||
$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();
|
||||
$class = isset($class) ? 'class="' . $class . '"': '';
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<picture>
|
||||
<picture <?= $class ?>>
|
||||
|
||||
<source srcset="<?= $webPSrcset ?>"
|
||||
sizes="<?= $sizes ?>" type="image/webp">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue