wishanddell/craft-glide
Composer 安装命令:
composer require wishanddell/craft-glide
包简介
Adds on-demand image transform support to Craft using Glide
README 文档
README
On-demand image manipulation for Craft CMS using Glide 3.0 from The PHP League. This plugin is an alternative to Crafts native image transforms and allows you to specify parameters to adjust the image on the fly in the url.
Supported file systems:
- Local
- AWS S3
Example Usage
<img src="/glide/myimage.jpg?w=100&h=200" alt="My Image" />
If your asset uploaded to craft is mysite.com/assets/animage.jpg
then this can now be rendered with Glide at mysite.com/glide/animage.jpg?w=100
For more information about what parameters are supported please see the Glide website.
Installation
composer require wishanddell/craft-glide
Assets can now be rendered through Glide using:
https://your-domain.com/glide/{filename}
AWS S3
When configuring your AWS filesystem, tick the box for public URLs and set the value to https://your-domain.com/glide/
The plugin will request the image from S3, apply the transforms and save the cached version back to your S3 bucket prefixed with glide
CDN / Advanced Usage
It is possible to create a CDN distribution using your domain as the origin, just make sure Query String Forwarding is enabled.
Security
By signing each request with a private key, no alterations can be made to the URL parameters.
Create the file config/glide2.php with the following:
<?php
return [
'signed' => true,
'key' => 'random-long-string',
];
Then you can use this service to generate the URL:
\wishanddell\glide\Plugin::getInstance()->render->url('image.jpg', ['w' => '100']);
Or with Twig:
<img src="{{ craft.glide.url('wedding.jpg', {w: 500}) }}" alt="My Image" />
Example transforms
craft.glide.url('testimage.png', {w: 200, h:200})
craft.glide.url('testimage.png', {w: 100, flip: 'v', blur: 5})
craft.glide.url('testimage.png', {w: 350, border: '10,5000,overlay', mark: 'test/another.png', markw: '100', markpos: 'top-left'})
wishanddell/craft-glide 适用场景与选型建议
wishanddell/craft-glide 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wishanddell/craft-glide 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wishanddell/craft-glide 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-05-05