Aller au contenu
← Retour aux projets

Laravel Image Manipulation Demo

#Laravel Image Upload Comparison

A Laravel 13 demo for comparing manual image processing, Laravel's native Image API, and Spatie Media Library side by side, followed by an advanced native-image production pipeline.

#Setup

composer install
cp .env.example .env
php artisan key:generate
touch database/database.sqlite
php artisan migrate
php artisan storage:link

The app uses SQLite and Laravel Herd, so it is available at http://image.test. No frontend build is required; the interface uses public/css/app.css directly.

Before uploading, confirm that GD is available:

php -m | grep -i gd

If GD is unavailable but Imagick is installed, add IMAGE_DRIVER=imagick to .env.

#The four demos

  • 1. Intervention — exposes every manual step: manager, decode, crop, encode, random filename, filesystem write, and database paths.
  • 2. Laravel Native — performs the same work with Laravel 13's fluent request Image API.
  • 3. Media Library — reduces the controller to attaching one file while the model declares its collection and conversion.
  • 4. Media Library++ — adds galleries, named conversions, responsive images, custom properties, and automatic file cleanup.
  • 5. Laravel Native++ — branches one upload into responsive WebP variants, a JPEG fallback, cover/contain comparisons, a blurred data URI, conditional effects, and regeneratable derivatives.

Laravel Native++ derivatives can be rebuilt from their stored originals:

php artisan images:regenerate-native
php artisan images:regenerate-native --id=1

All conversions run synchronously for the demo, so no queue worker is required. If a conversion definition changes, regenerate existing files with:

php artisan media-library:regenerate

Run the test suite with:

php artisan test --compact

Nouvelle version disponible.