nerdcel/kirby3-responsive-images
Composer 安装命令:
composer require nerdcel/kirby3-responsive-images
包简介
Kirby3 plugin to manage responsive images settings using the panel.
README 文档
README
This plugin provides functionality to generate responsive images in your Kirby CMS projects.
Installation
- Using Composer:
composer require nerdcel/kirby3-responsive-images
- Manually: Download the latest release
and copy the contents of the into your
site/plugins/responsive-imagesfolder.
Configuration
You can configure the plugin by adding the following options to your config.php file. Consider using the "ready" hook inside the kirby config if you are
calling the kirby() function to set the configPath.
'ready' => function ($kirby) { return [ 'nerdcel.responsive-images' => [ 'configPath' => kirby()->root('content'), 'configFile' => 'responsive-img.json', 'quality' => 75, 'defaultWidth' => 1024, 'allowedRoles' => ['admin'], ], ]; }
If you open the panel now, the plugin should have generated an empty json file with the following content:
{"breakpoints": [], "settings": []}
Usage
Generating Responsive Images To generate a responsive image, use the makeResponsiveImage method:
use Nerdcel\ResponsiveImages\ResponsiveImages; use Kirby\Cms\File; $responsiveImages = ResponsiveImages::getInstance(); $imageTag = $responsiveImages->makeResponsiveImage( 'settings-slug', $file, // instance of Kirby\Cms\File 'custom-classes', true, // lazy loading 'Alt text', 'webp' ); echo $imageTag;
But there is also a helper function that you can use to generate responsive images:
echo responsiveImage('settings-slug', $file, 'custom-classes', true, 'Alt text', 'webp');
Focal Point
You can set the focal point(s) of an image for different viewports by adding the following fields to the image file blueprint:
... fields: focalpoints: label: Focal Points override type: focalpoints
License This plugin is licensed under the MIT License. See the LICENSE file for more details.
nerdcel/kirby3-responsive-images 适用场景与选型建议
nerdcel/kirby3-responsive-images 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.12k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2023 年 01 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kirby」 「kirby-plugin」 「kirby-cms」 「getkirby」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nerdcel/kirby3-responsive-images 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nerdcel/kirby3-responsive-images 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nerdcel/kirby3-responsive-images 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kirby 5 field for hierarchical menus with drag & drop level indentation.
Show references to a page or file on the objects blueprint.
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Plausible integration for Kirby CMS
Kirby Admin Bar
统计信息
- 总下载量: 2.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-25

