iamriajul/thumbhash-laravel
Thumbhash
A PHP implementation of Thumbhash with Laravel integration.
Thumbhash is a compact representation of a placeholder for an image.
![]()
⚠️ I highly recommend to have Imagick extension installed on your computer. GD extension has only 7 bits of alpha channel resolution, and 127 is transparent, 0 opaque. While the library will still work, you may have different image between platforms. See on stackoverflow
Supported Laravel Version
9.0 ~ 12.x
Installation
Install using composer
composer require iamriajul/thumbhash-laravel
Publish config file (Optional for )
php artisan vendor:publish --provider="Riajul\Thumbhash\ThumbhashServiceProvider"
Set up config file on config/thumbhash.php
Done!
Usage
Facade
Thumbhash::encode($file);
$file can be any Intervention make method acceptable source.
app helper function
app('thumbhash')
->encode(request('file'));
TODO:
- Support decoding from thumbhash base64 string.
- Support encoding to thumbhash binary array.
- Support decoding from thumbhash binary array.
- Support encoding to dataURL.
License
Thumbhash is licensed under The MIT License (MIT).
Related Packages
Generate low-quality image placeholders for lazyloading Statamic assets
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.3 | ^8.1 | ^9.0 | | MIT | |
| 1.0.2 | ^8.1 | ^9.0 | | MIT | |
| 1.0.1 | ^8.1 | ^9.0 | | MIT | |
| 1.0.0 | ^8.0 | ^8.0 | | MIT |