hengebytes / ibexa-blurhash
Symfony 扩展,用于在 Ibexa CMS 中生成图片模糊哈希
v1.0.2
2023-11-03 10:23 UTC
Requires
- php: >=8.1
- ibexa/graphql: ^4.0
- intervention/image: ^2.5
- kornrunner/blurhash: ^1.1
- symfony/config: ^5.4|^6.0|^7.0
- symfony/dependency-injection: ^5.4|^6.0|^7.0
- symfony/http-kernel: ^5.4|^6.0|^7.0
This package is not auto-updated.
Last update: 2024-09-21 03:26:06 UTC
README
composer require hengebytes/ibexa-blurhash
(可选) 配置图片转换
# config/packages/ibexa_blurhash.yaml parameters: # uploaded image resized to 75x75 before encoding ibexa_blurhash.encode.resize_original_width: 75 ibexa_blurhash.encode.resize_original_height: 75 # blurhash generated with 4x3 component, x and y component counts must be between 1 and 9 inclusive. ibexa_blurhash.encode.blurhash_x_count: 4 ibexa_blurhash.encode.blurhash_y_count: 3
在 GraphQL 中查询模糊哈希数据。
query { media { image(contentId: 19) { image { uri additionalData { blurhash } } } } }
在浏览器中解码
注意
由于模糊哈希是在图片上传时生成的,所以只有在此捆绑包安装后上传的图片才能使用。
致谢
- 算法作者 - blurha.sh
- 受 symfony/ux-lazy-image 启发