foerdeliebe / kirby-images
3.0.0
2024-09-17 14:29 UTC
Requires
README
其他格式和响应式图片
此插件还在开发中!
安装
下载
下载并将此仓库复制到 /site/plugins/images
。
Git 子模块
git submodule add https://github.com/deichrakete/kirby-images.git site/plugins/images
Composer
composer require deichrakete/kirby-images
设置
配置
在 site/config/config.php 中
return [ 'deichrakete.images.avif' => true, // AVIF Support - false is default 'deichrakete.images.webp' => true, // WEBP Support - false is default 'thumbs' => [ 'driver' => 'im', // optional - ImageMagick has better avif support 'srcsets' => [ 'teaser' => [ '400w' => ['width' => 400, 'height' => 200, 'crop' => true, 'quality' => 85], '800w' => ['width' => 800, 'height' => 400, 'crop' => true, 'quality' => 85], '1000w' => ['width' => 1000, 'height' => 500, 'crop' => true, 'quality' => 85], '1200w' => ['width' => 1200, 'height' => 600, 'crop' => true, 'quality' => 85], ], 'slide' => [ '400w' => ['width' => 400, 'quality' => 85], '800w' => ['width' => 800, 'quality' => 85], '1000w' => ['width' => 1000, 'quality' => 85], '1200w' => ['width' => 1200, 'quality' => 85], ], ] ] ];
模板
<?php snippet('images', [ 'image' => $image, # Kirby\Cms\File 'title' => 'Another slide image', # optional 'sizes' => '(min-width: 800px) 33vw, 50vw', # optional 'srcset' => 'slide', # required 'caption' => 'A caption that describes the image', # optional 'class' => 'first-slide', # optional 'lazy' => false, # optional ]) ?>
选项
开发
许可证
MIT