gesagtgetan/krakenoptimizer
Composer 安装命令:
composer require gesagtgetan/krakenoptimizer
包简介
Image optimizer for Neos utilizing the Kraken API
README 文档
README
GesagtGetan.KrakenOptimizer
Image optimizer for Neos utilizing the Kraken API
| Version | Neos |
|---|---|
| 1.x | 2.3 LTS |
| 2.x | 3.x, 4.x |
| 3.x | 5.x |
Installation
composer require gesagtgetan/krakenoptimizer
Create a Kraken account on https://kraken.io and generate new API Keys on https://kraken.io/account/api-credentials.
Add the credentials to your global Settings.yaml:
GesagtGetan:
KrakenOptimizer:
krakenOptions:
auth:
api_key: '<yourApiKey>'
api_secret: '<yourApiSecret>'
Usage
Warning:
⚠ As with any plugin that actively works on your database and resources it is a good idea to make sure you keep regular backups for your website. No known disasters have been caused by this plugin, but it's always better to be safe than sorry.
- We usually want to optimize all existing resources. We can do this by running this CLI command
./flow kraken:optimize
All existing thumbnails will be replaced by optimized version from Kraken. By default we perform lossy optimizations,
because this can dramatically decrease image size, while no noticeable decrease in image quality should occur. You can
change the optimization strategy by altering the krakenOptions in the settings (set lossy: false), along with other
arbitrary Kraken API options (see https://kraken.io/docs/).
Tip:
In case something goes wrong during the initial optimization, it's possible to resume optimization from a preferred offset.
For example ./flow kraken:optimize --offset 300 will skip the first 299 thumbnails.
Warning:
⚠ Executing this command multiple times will send potentially already optimized images to the Kraken API and thus will still count towards your API quota and can lead to "over optimized" images when running lossy optimizations multiple times.
- Now is the perfect time to activate live optimizations. All generated thumbnails after the initial optimiziation will be send to kraken for improvement when this flag is set:
GesagtGetan: KrakenOptimizer: liveOptimization: true
♻ Don't forget to flush your caches after adding the flag in a production environment.
- Delete Production cache
FLOW_CONTEXT=Production ./flow flow:cache:flush
Additional options
optimizeOriginalResource
By enabling the optimizeOriginalResource flag, the original image will be replaced with an optimized version,
if no thumbnail creation was necessary for a particular image.
Neos will not create a thumbnail for an image, if the the necessary dimensions are equal or lower than the original image.
By default we do not optimize original images. Make sure you have regular backups of your server, in case something goes wrong during optimization!
Usage:
GesagtGetan: KrakenOptimizer: optimizeOriginalResource: true
Troubleshooting and FAQ
Q: I already optimized my thumbnails before installing this plugin, but I'm unhappy with the result
A: If your thumbnails already show signs of high compression like artefacts, this plugin can not restore that missing
information. In that case it's necessary to clear all your existing thumbnails with ./flow media:clearthumbnails.
Be aware that this can put a lot of load on your server since all thumbnails need recreation, when a page has been called.
You can activate liveOptimization right away, or optimize the created thumbnails later by running ./flow kraken:optimize.
If you need all your thumbnails in all your preset sizes, you can pre-generate them by running ./flow media:createthumbnails and
./flow media:renderthumbnails. Either optimize afterwads or have liveOptimization activated.
gesagtgetan/krakenoptimizer 适用场景与选型建议
gesagtgetan/krakenoptimizer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 73 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 04 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gesagtgetan/krakenoptimizer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gesagtgetan/krakenoptimizer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 73
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-04-23