Created
June 26, 2020 07:20
-
-
Save foobartel/71824b19ae747ffd99e3874d5a1de600 to your computer and use it in GitHub Desktop.
Kirby 3 Editor - Resize images in Editor snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if( $block->isNotEmpty() ): ?> | |
<figure<?= attr( [ 'class' => $attrs->css()->value() ], ' ' ) ?>> | |
<?php if( $attrs->id()->toFile() ): ?> | |
<?php $imagesrc = $attrs->id()->toFile()->resize( 1200, null, 60 )->url(); ?> | |
<?php else: ?> | |
<?php $imagesrc = $src ?> | |
<?php endif ?> | |
<?php if( $attrs->link()->isNotEmpty() ): ?> | |
<a href="<?= $attrs->link()->toUrl() ?>"> | |
<img src="<?= $imagesrc ?>" alt="<?= $attrs->alt() ?>" sx> | |
</a> | |
<?php else: ?> | |
<img src="<?= $imagesrc ?>" alt="<?= $attrs->alt() ?>"> | |
<?php endif ?> | |
<?php if ( $attrs->caption()->isNotEmpty() ): ?> | |
<figcaption> | |
<?= $attrs->caption() ?> | |
</figcaption> | |
<?php endif ?> | |
</figure> | |
<?php endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment