blueways/bw-placeholder-images
Composer 安装命令:
composer require blueways/bw-placeholder-images
包简介
Inline SVG placeholder images with lazy loading
README 文档
README
TYPO3 Extension: Placeholder Images
Generates SVG inline placeholder images from FAL Media elements. The Foundation Interchange plugin is configured to resolve the right responsive image. The SVG placeholder consists of three gradients with 9 different colors from the original FAL image to make it look more natural.
The color extrection code is based on Frans Saris lazy_load_placeholder TYPO3 extension. Lazy loading code inspired by Mika Tuupola. SVG inline compression is done like Taylor Hunt explained it in his blog post.
Requirements
- TYPO3 v8.0+
- Foundation 6 (or Foundation.Interchange Plugin)
Installation
This extension is installable only via composer.
composer require blueways/bw-placeholder-images- include TypoScript template
Configuration
The Javascript File is automatically included via includeJSFooterLibs. This can be disabled by unsetting
plugin.bw_placeholder_images.settings.placeholderImagesJS = EXT:bw_placeholder_images/Resources/Public/JavaScript/placeholderImages.js
Useage
The color extraction starts automatically after uploading any jpg, jpeg, gif or png image via FAL.
Viewhelper
Register the viewhelpers in any fluid template.
{namespace bw=Blueways\BwPlaceholderImages\ViewHelpers}
bw:lazyImage
This viewhelper acts like the normal <f:image /> viewhelper, however there is an svg image output of the referenced src or image. The final images are added via additionalAttributes in Foundation Interchange style.
Example with different crop variants:
<bw:lazyImage image="{mediaElement}" cropVariant="small" width="585" additionalAttributes="{data-lazy-interchange: ' [{f:uri.image(image:mediaElement,maxWidth:\'600\', cropVariant:\'small\')}, small], [{f:uri.image(image:mediaElement,maxWidth:\'500\', cropVariant:\'medium\')}, medium], [{f:uri.image(image:mediaElement,maxWidth:\'450\', cropVariant:\'large\')}, large] '}" />
bw:lazyPlaceholder
Acts like <f:uri.image /> viewhelper.
Foundation Interchange can handle responsive background images, this viewhelper helps to generate the nessecary Output of an image resource path.
Example without crop variant and only one final image for all sizes:
<div style='background-image: url("{bw:lazyPlaceholder(src:'{image.properties.uid}')}");' data-lazy-interchange="[{f:uri.image(src:'{image.properties.uid}', maxWidth:'640')}, small]" ></div>
Attention: The style='' Tag needs to be rendered with single quotes.
TODO
- include dependencies in package
- make fallback color editable via typoscript
- animate image switch
blueways/bw-placeholder-images 适用场景与选型建议
blueways/bw-placeholder-images 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.09k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 blueways/bw-placeholder-images 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 blueways/bw-placeholder-images 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-01
