thoughtco/statamic-blurhash
最新稳定版本:2.0.0
Composer 安装命令:
composer require thoughtco/statamic-blurhash
包简介
A Statamic add-on to generate and decode blurhash images
README 文档
README
Blur Hash
An add-on for Statamic that encodes, decodes and generates Blur Hash images to use as placeholders during image loading.
Installation
First, require BlurHash as a Composer dependency:
composer require thoughtco/statamic-blurhash
Optionally, you may publish the config file for the BlurHash library this addon makes use of, allowing you finer control over the image output.
php artisan vendor:publish --provider="Bepsvpt\Blurhash\BlurHashServiceProvider"
Usage
This add-on provides a number of tags:
Outputting a BlurHash image
{{ blur_hash:image }}
or
{{ blur_hash :image="asset" }}
or
{{ blur_hash :url="url" }}
or
{{ blur_hash :id="asset_id" }}
or
{{ blur_hash :path="local_path" }}
This tag will output an encoded image in the following format:
<img src="data:image/png;base64,iVBOR…8f8luO3RPLKe4AAAAAElFTkSuQmCC" />
Any other parameters you pass will be added to the tag, for example:
{{ blur_hash:image width="640" height="640" onload="console.log('loaded')" }}
will output as:
<img src="data:image/png;base64,iVBOR…8f8luO3RPLKe4AAAAAElFTkSuQmCC" width="640" height="640" onload="console.log('loaded')" />
If you want to override the output, you can publish the view to your own views folder by running:
php artisan vendor:publish --tag="statamic-blurhash"
it will then be found at resources/views/vendor/statamic-blurhash/output.blade.php
Encoding a BlurHash image
{{ blur_hash:encode image="path_or_asset" }}
or
{{ blur_hash:encode :url="url" }}
or
{{ blur_hash:encode :id="asset_id" }}
or
{{ blur_hash:encode :path="path" }}
This will return a BlurHash encoded URL, useful if you want to return this to JavaScript or a 3rd party service (such as Algolia).
Decoding a BlurHash image
{{ blur_hash:decode hash="string" }}
This will decode an BlurHash string to an image, following the same conventions as Outputting a BlurHash image.
Support
BlurHash is a free addon so support is provided on an as-we-have-capacity basis. If you have a feature request or experience a bug, please open a GitHub Issue.
Only the latest version of this addon is supported. If you open a bug report using an old version, your issue will be closed.
thoughtco/statamic-blurhash 适用场景与选型建议
thoughtco/statamic-blurhash 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.5k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2022 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 thoughtco/statamic-blurhash 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thoughtco/statamic-blurhash 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-11-06
