Search by

folklore / laravel-image

dmongeau

On-the-fly image renditions for Laravel: presets, signed URLs and responsive variants, behind a CDN

Package info

github.com/folkloreinc/laravel-image

pkg:composer/folklore/laravel-image

Statistics

Installs: 5 961

Dependents: 3

Suggesters: 3

Stars: 4

Open Issues: 2

v2.0.0-alpha.3 2026-10-29 18:54 UTC

README

Tests

On-the-fly image renditions for Laravel: presets, crops, formats and responsive variants, rendered once and served behind a CDN.

This is the v2.x branch, where 2.0 is developed, and the default branch. 2.0 is released as alphas (composer require folklore/laravel-image:^2.0@alpha, PHP 8.3+ and Laravel 12+); an alpha can break the previous one, so read the CHANGELOG before you update. 1.x is maintained on v1.x: composer require folklore/laravel-image:^1.1.

2.0

2.0 is built on Intervention Image 4, with libvips when available:

Image::for($media)->preset('card')->url();
Image::for('uploads/photo.jpg')->width(800)->ratio('16:9')->avif()->url();
Image::for($media)->variants('card'); // width, height and URL of each variant, for APIs

In the alphas today:

  • Presets and canonical specs, in versioned URLs that change when a preset or an original changes.
  • Secure by default: opt-in routes (Route::image()), presets or signed URLs only, enforced limits, private images through expiring URLs.
  • Derivatives rendered once with libvips, Imagick or GD, stored on any Laravel disk with a lock per variant, served with long-lived caching headers behind a CDN.
  • Sources resolved from disks, and from media ids with laravel-mediatheque 2's media resolver.
  • ImageVariantResource, Image::fake() and image:doctor.

Upgrading from 1.x: 1.x URLs keep working through Route::imageLegacy(), and a compatibility layer keeps the 1.x API working, deprecated, until 3.0. php artisan image:upgrade --check lists what a project uses; docs/upgrade.md has the steps.

Planned (roadmap): focal point and non-destructive edits (transform), channel presets, responsive images with srcset() and <x-image>, more operations, and the Rector rules of the upgrade.

The guides of the alpha are in docs/guides/: getting started, presets, URLs and signatures and delivery behind a CDN.

The plan is in docs/: the architecture, the decisions, the roadmap and the upgrade guide. #3 is the index of the plan and tracks 1.x.

Contributing

See CONTRIBUTING.md for the workflow, and SECURITY.md to report a vulnerability privately.

License

MIT. See LICENSE.md.