This is my package laravel-image-resizer
Create resized images on demand!
Installation
You can install the package via composer:
composer require reworck/laravel-image-resizer
You can publish the config file with:
php artisan vendor:publish --tag="image-resizer-config"
This is the contents of the published config file:
return [
// Allowed sizes {WIDTH}x{HEIGHT}
'sizes' => [
// '300x300',
// '600',
]
];
A width and height can be specified by separating them with an x
. Only providing 1 number will preserve the aspect ratio and resize to the given width.
Usage
Resize the images in your views by passing it to the following url:
<img src={{ asset('storage/resizes/200x200/posts/image.jpg') }}
The route url is prefixed with storage/resizes/
Followed by a size whitelisted in the config. After that pass the path to the file saved in the public disk defined in filesystems.php
. The image will be resized using spatie/image
and saved to the storage.
Testing
make test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.