srwiez/thumbhash
PHP implementation of ThumbHash for generating ultra-compact image placeholders. Encode images into short hashes, decode them into tiny blurred previews, and integrate easily with Laravel to improve perceived loading performance and layout stability. Ideal for progressive image loading.
Architecture fit
srwiez/thumbhash provides encode/decode in pure PHP, which slots naturally into a Laravel media pipeline: it is stateless, has no external service dependency, and its output is a short binary string that fits comfortably in a VARCHAR/BLOB column or a cache value.ThumbhashService and swap later if needed.Integration feasibility
ImageUploaded event, a thumbhash nullable column on the media table, an accessor that emits a base64 data URI, and a Blade component or Inertia prop that renders it as a background layer.Technical risk
Key questions
Stack fit
<x-thumbhash> component.<img>, with the real image fading in on load.Migration path
thumbhash column, backfill asynchronously, and let the frontend prefer ThumbHash when present and fall back to BlurHash. No big-bang cutover required.Compatibility
VARCHAR(64) or a binary column, never TEXT.Sequencing
ThumbhashService with encode(Media): string and a decode helper, so the package is one import behind an interface.media.thumbhash. Fail open — a missing hash must never block image availability.Maintenance
composer.json, record a fork/vendor contingency in the ADR, and add a check to our dependency dashboard so an abandoned upstream is visible early rather than at an audit.Support
Scaling
Failure modes
failed() handler that logs and clears the job without blocking the upload.thumbhash IS NULL rate for recent uploads.Ramp-up
How can I help you explore Laravel packages today?