定制 dnsk-work/twill-picture 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dnsk-work/twill-picture

最新稳定版本:v1.0.1

Composer 安装命令:

composer require dnsk-work/twill-picture

包简介

Progressive blur-up <x-twill-picture::picture> Blade component for Twill + Glide (or any query-param image transform service)

README 文档

README

A <x-picture> Blade component for Laravel Twill that renders responsive WebP images with a progressive blur-up (LQIP) loading effect. Shows a blurred low-quality image placeholder while the full image loads, then fades it in and removes the placeholder from the DOM.

Works with Glide, imgproxy, Cloudinary, imgix, or any image service that accepts w, q, and fm as URL query parameters.

Installation

composer require dnsk-work/twill-picture

The component is auto-registered by Laravel as <x-twill-picture::picture>.

To use the shorter <x-picture> tag, publish the view to your app:

php artisan vendor:publish --tag=twill-picture-views

Usage

<x-twill-picture::picture
    src="{{ $block->image('hero_image', 'desktop') }}"
    alt="{{ $title }}"
    loading="eager"
    fetchpriority="high"
    sizes="100vw"
    class="w-full h-full"
/>

Props

Prop Default Description
src '' Image URL. Existing query params are preserved.
alt '' Alt text.
loading lazy Set to eager for above-the-fold / LCP images.
fetchpriority null Set to high for LCP images.
width null Passed to <img> for layout stability (CLS).
height null Passed to <img> for layout stability (CLS).
sizes 100vw CSS sizes attribute for responsive image selection.
class Applied to the outer wrapper <div>.

Any other attributes are forwarded to the <img> element.

How it works

  1. Renders a wrapper <div> with position: relative; overflow: hidden.
  2. Inside it, an absolutely-positioned <div> shows a 40px-wide WebP LQIP (w=40&q=10&fm=webp) scaled up with blur(24px). inset: -10% hides the blur-edge glow.
  3. A <picture> element provides a WebP <source> with srcset at 400w 800w 1200w 1600w 2400w, plus a fallback <img> at opacity: 0.
  4. On img.onload, opacity transitions to 1 and the LQIP element is removed from the DOM.

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12

License

MIT

Made by DNSK.WORK, a UI/UX agency.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固