New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

kwaadpepper/image-resizer

Resize images on the fly and cache them
8,484 5
Install
composer require kwaadpepper/image-resizer
Latest Version:4.0.1
PHP:^8.3
Laravel:11 · 12 · 13
Older releases:7 · 8 · 10
License:MIT
Last Updated:Mar 29, 2026
Links: GitHub  ·  Packagist
Maintainer: Kwaadpepper

Image Resizer

Latest Version on Packagist Total Downloads CI

Resizes an image on the fly and returns the new link

Installation

Via Composer

composer require kwaadpepper/image-resizer

Usage

1 - Publish config

php artisan vendor:publish --provider="Kwaadpepper\ImageResizer\ImageResizerServiceProvider"

2 - Set a config in templates array (config/image-resizer.php)

/**
 *   resize => will resize the image (boolean)
 *   fit => Combine cropping and resizing to format image in a smart way (boolean)
 *   keepRatio => will keep image ratio wile resizing (boolean)
 *   trim => boolean to trim the image using border color
 *   inCanvas => to make sure image boundarie is respected
 *   format => select tha wantd ouput form, yan can just convert images if you want
 */
'templates' => [
    'smallWebp' => [
        'height' => 500,
        'width' => 250,
        'inCanvas' => true,
        'format' => 'webp',
        'trim' => ['transparent', null, 10]
    ]
]

3 - type in console php artisan storage:link

4 - in your blade template override an image link

<img src="{{ asset(resize('images/volaillesfr_landing.png', 'smallWebp')) }}" alt="My resized image">

5 - Optional You can manually clean outdated cache files using command php artisan image-resizer:clean-cache or force cleaning the cache using php artisan cache:clear

  • Please note that this is automatically scheduled on production every half hour
  • Cache lifetime defaults to 1 week (configurable via lifetime in config/image-resizer.php). Cached images are regenerated on demand.

Change log

Please see the changelog for more information on what has changed recently.

Testing

composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email github@jeremydev.ovh instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

Related Packages

emiliolodigiani/laravel-images

Responsive image resizing with srcset generation for Laravel

1,046 0
anakadote/laravel-5-image-manager

Image resizing and cropping package for Laravel.

8,961 14
antennaio/laravel-clyde

Image uploads and manipulation for Laravel, a wrapper around Glide

2,635 29
jasis/image-resizer

Image resizer library for laravel

36 0
maximumadvertising/laravel-image-resize

Dynamically resize an image and returns the URL using Intervention and Storage

2,075 6

Version History

Version Released PHP Laravel License
4.0.1 ^8.3 ~11|~12|~13 MIT
4.0.0 ^8.3 ~11|~12|~13 MIT
3.1.1 ^8.2 ~11|~12 MIT
3.1.0 ^8.2 ~11|~12 MIT
3.0.2 ^8.2 ~11 MIT