brocode/module-image-optimizer-avif
Composer 安装命令:
composer require brocode/module-image-optimizer-avif
包简介
README 文档
README
📖 Full docs, design notes & production guidance: brocode.at/modules/module-image-optimizer Part of the BroCode Image Optimizer family for Magento 2.
This module provides an AVIF image converter for Magento 2. It is based on the brocode/module-image-optimizer
Requirements
- Magento 2.4.x
- Web server: nginx (the only server Adobe supports from 2.4.9; nginx 1.30). Apache config is included for older installs, but Apache was dropped from Magento's tested requirements at 2.4.8-p3 / 2.4.7-p7.
- PHP 8.3 / 8.4 (8.5 on 2.4.9)
Installation
composer require brocode/module-image-optimizer-avif
bin/magento module:enable BroCode_ImageAvifOptimizer
bin/magento setup:upgrade
Configuration
The configuration can be found under Stores -> Configuration -> Services -> BroCode ImageOptimizer -> Image Avif. Currently the image quality can be set (value between 0 and 100) and the converter can be disabled.
Apache Configuration
Add following snippet to the .htaccess file, which serves public images that are converted:
############################################
## if client accepts avif, rewrite image urls to use avif version
AddType image/avif .avif
RewriteCond %{HTTP_ACCEPT} image/avif
RewriteCond %{REQUEST_FILENAME} (.*)\.(png|gif|jpe?g)$
RewriteCond %{REQUEST_FILENAME}\.avif -f
RewriteRule ^ %{REQUEST_FILENAME}\.avif [L,T=image/avif]
Nginx Configuration
Merge into the project nginx vhost (nginx.conf.sample). Place the map in http {}; add the location before Magento's generic static location under /media/.
# In http { } (once per nginx instance or included vhost file)
map $http_accept $avif_suffix {
default "";
"~*avif" ".avif";
}
# In server { }
location ~* ^/media/.+\.(png|gif|jpe?g)$ {
add_header Vary Accept;
try_files $uri$avif_suffix $uri $uri/ /get.php$is_args$args;
}
Further Information
See base module for more informations on how to setup the image optimizer: brocode/module-image-optimizer
Module family
| Module | Purpose |
|---|---|
| module-image-optimizer | Base: scan pub/media, write modern-format sidecars |
| module-image-optimizer-webp | WebP converter |
| module-image-optimizer-avif | AVIF converter |
| module-image-optimizer-queue | Async conversion via the Magento queue |
| module-image-optimizer-amqp | Async conversion over RabbitMQ/AMQP |
Docs & guides: brocode.at
brocode/module-image-optimizer-avif 适用场景与选型建议
brocode/module-image-optimizer-avif 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 137 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 06 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 brocode/module-image-optimizer-avif 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 brocode/module-image-optimizer-avif 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 137
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 2
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-28