NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Media Library for Laravel

Placeholders (LQIP)

On add, the package records pixel dimensions and computes two low-quality image placeholders from a downscaled copy: a ThumbHash and a Blurhash. Both encoders are pure-PHP ports validated against the reference vectors — no third-party dependency:

$media->width;                 // e.g. 1920 (null for non-images)
$media->height;                // e.g. 1080

$media->placeholder();         // ['thumbhash' => '1QcSHQ…', 'blurhash' => 'LPDI|4…']
$media->thumbhash();           // string|null
$media->blurhash();            // string|null
$media->placeholderDataUri();  // 'data:image/png;base64,…' — a tiny blur-up image

placeholderDataUri() decodes a placeholder server-side (ThumbHash preferred, Blurhash fallback) into a tiny PNG data: URI you can use as a blur-up background while the full image loads. Each placeholder type is independently toggleable in config.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.