optimize image
This commit is contained in:
parent
53a2ed8b0f
commit
fc51258d40
3 changed files with 13 additions and 12 deletions
|
|
@ -13,14 +13,15 @@ return [
|
||||||
'format' => 'webp'
|
'format' => 'webp'
|
||||||
],
|
],
|
||||||
'srcsets' => [
|
'srcsets' => [
|
||||||
'default' => [
|
'default' => [200, 400, 600, 800, 1024, 1440, 2048],
|
||||||
['width' => 200, 'format' => 'webp'],
|
'webp' => [
|
||||||
['width' => 400, 'format' => 'webp'],
|
'200w' => ['width' => 200 * 1.5, 'format' => 'webp'],
|
||||||
['width' => 600, 'format' => 'webp'],
|
'400w' => ['width' => 400 * 1.5, 'format' => 'webp'],
|
||||||
['width' => 800, 'format' => 'webp'],
|
'600w' => ['width' => 600 * 1.5, 'format' => 'webp'],
|
||||||
['width' => 1024, 'format' => 'webp'],
|
'800w' => ['width' => 800 * 1.5, 'format' => 'webp'],
|
||||||
['width' => 1440, 'format' => 'webp'],
|
'1024w' => ['width' => 1024 * 1.5, 'format' => 'webp'],
|
||||||
['width' => 2048, 'format' => 'webp']
|
'1440w' => ['width' => 1440 * 1.5, 'format' => 'webp'],
|
||||||
|
'2048w' => ['width' => 2048 * 1.5, 'format' => 'webp']
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
<div class="image-wrapper">
|
<div class="image-wrapper">
|
||||||
<?php if ($event->gallery()->toFiles()->count() > 1): ?>
|
<?php if ($event->gallery()->toFiles()->count() > 1): ?>
|
||||||
<?php snippet('picture', [
|
<?php snippet('picture', [
|
||||||
'file' => $event->gallery()->toFiles()->first()->thumb(),
|
'file' => $event->gallery()->toFiles()->first(),
|
||||||
'class' => 'image-cover',
|
'class' => 'image-cover',
|
||||||
'size' => (100 / (12 / $span) - 10)
|
'size' => (100 / (12 / $span) - 10)
|
||||||
]) ?>
|
]) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php
|
<?php
|
||||||
$file = $event->gallery()->toFiles()->count() > 1 ? $event->gallery()->toFiles()->nth(1) : $event->gallery()->toFiles()->first();
|
$file = $event->gallery()->toFiles()->count() > 1 ? $event->gallery()->toFiles()->nth(1) : $event->gallery()->toFiles()->first();
|
||||||
snippet('picture', ["file" => $file->thumb(), 'size' => (100 / (12 / $span) - 10), 'alt' => null]);
|
snippet('picture', ["file" => $file, 'size' => (100 / (12 / $span) - 10), 'alt' => null]);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="event-card__infos">
|
<div class="event-card__infos">
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
<div class="hero__image" style="--color: var(--color-season)">
|
<div class="hero__image" style="--color: var(--color-season)">
|
||||||
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
|
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
|
||||||
<a href="<?= $site->heroLinkUrl()->toUrl() ?>" title="en savoir plus">
|
<a href="<?= $site->heroLinkUrl()->toUrl() ?>" title="en savoir plus">
|
||||||
<?php snippet('picture', ['file' => $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>
|
<?php snippet('picture', ['file' => $site->heroImage()->toFile(), 'lazy' => false, 'size' => 60]) ?>
|
||||||
</a>
|
</a>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php snippet('picture', ['file' => $site->heroImage()->toFile()->thumb(), 'lazy' => false, 'size' => 50]) ?>
|
<?php snippet('picture', ['file' => $site->heroImage()->toFile(), 'lazy' => false, 'size' => 60]) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue