Laravel Picsize is a simple and flexible Laravel package that helps you to resize images on the fly, then store and reuse the resized versions — all with one line of code.
It’s designed for Laravel projects that need on-demand thumbnails, resized images, or optimized storage, without reinventing the wheel every time.
✅ Simple Facade: Picsize::resize($path, $width, $height)
✅ Disk-based storage (local, public, S3, FTP, etc.)
✅ Automatic fallback image if source is missing
✅ Respects Laravel’s Filesystem & URL helpers
✅ Auto-creates output folders with proper permissions (local disks)
✅ Compatible with Laravel 9.x – 12.x
- PHP >= 8.1
- Laravel >= 9.x
- Intervention Image (included)
Install the package via Composer:
composer require imeysam/laravel-picsizeBy default, the package uses these settings:
disk→publicinput_path→uploadsoutput_path→imagesfallback_image→images/default.jpg
To customize these, publish the config file.
You can do this in two ways:
Option 1 — Using the Provider name (recommended)
php artisan vendor:publish --provider="Imeysam\Picsize\Providers\PicsizeServiceProvider"Option 1 — Using the tag config
php artisan vendor:publish --tag=config
config/picsize.php
return [
'disk' => 'public',
'input_path' => 'uploads',
'output_path' => 'images',
'fallback_image' => 'images/default.jpg',
];Once installed and configured, using the picsize is super simple.
You can call the resize method using the Facade, or inject the service into your classes.
use Imeysam\Picsize\Facades\Picsize;
class ImageController extends Controller
{
public function show()
{
// Resize to 400x300 and get the full URL
$url = Picsize::resize('photos/test.jpg', 400, 300);
...
}
}use Imeysam\Picsize\Picsize;
class ImageController extends Controller
{
public function show(Picsize $picsize)
{
// Resize to 400x300 and get the full URL
$url = $picsize->resize('photos/test.jpg', 400, 300);
...
}
}<img src="{{ Picsize::resize('photos/test.jpg', 400, 300) }}">- This package is created for Laravel >= 9.x and is released under the MIT License and, based on Intervention Image.