foerdeliebe / kirby-images

此包已被弃用且不再维护。作者建议使用 deichrakete/kirby-images 包。

其他格式和响应式图片

安装: 481

依赖项: 0

建议者: 0

安全性: 0

星标: 2

关注者: 3

分支: 0

开放问题: 3

类型:kirby-plugin

3.0.0 2024-09-17 14:29 UTC

This package is auto-updated.

Last update: 2024-09-17 14:30:56 UTC


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

致谢