Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Image Laravel

Image Laravel Laravel Package

intervention/image-laravel

Laravel integration for Intervention Image that provides a service provider, facade, and publishable configuration file, letting you set the image driver and options once centrally instead of repeating them on every image manager call.

View on GitHub
Deep Wiki
Context7

Intervention Image Laravel provides seamless integration between the Intervention Image library and your Laravel application. It ships with a service provider, facade, and a publishable configuration file, so you can manage image processing settings centrally rather than repeating them on every call. Simply install via Composer (composer require intervention/image-laravel) on Laravel 8 or higher.

The package is designed to simplify image manipulation within Laravel’s ecosystem, letting you choose between GD Library and Imagick drivers through one global config. By default it uses GD, but you can tailor the driver and its options to match your PHP setup. A single Artisan command publishes config/intervention-image.php for quick customization.

  • Application-wide configuration published to config/intervention-image.php
  • Laravel service provider and facade for easy access
  • Choice of GD or Imagick drivers
  • Simple Composer installation for Laravel 8+
  • Centralized image driver settings
Frequently asked questions about Image Laravel
How do I install Intervention Image Laravel in my Laravel 9/10 project?
Run `composer require intervention/image-laravel` in your project root. The package auto-registers its service provider, so no manual bootstrapping is needed. Publish the config file with `php artisan vendor:publish --provider="Intervention\Image\Laravel\ServiceProvider"` to customize driver settings (GD/Imagick) globally.
What’s the difference between using this package vs. raw Intervention Image in Laravel?
This package adds Laravel-specific features like a facade (`Image::make()`), publishable config (`config/image.php`), and a `response()->image()` macro for API responses. It also centralizes driver settings (GD/Imagick) to avoid per-call configuration, reducing boilerplate.
Can I switch between GD and Imagick drivers dynamically in production?
No, the driver is set in `config/image.php` and applies globally. For dynamic switching, extend the package or use environment-based configs (e.g., `.env` overrides). Test fallback logic if Imagick fails (e.g., `try-catch` blocks around `Image::make()`).
How do I use the facade in a Laravel controller to resize an uploaded image?
Use `Image::make($filePath)->resize(300, 200)->save($destination)`. The facade is a shortcut for `app('image')->make()`. For file uploads, access the file via `$request->file('image')->store()` or `$request->image->path()`.
Does this package support async image processing with Laravel queues?
Yes, but avoid the facade in queue jobs (global state risks). Instead, inject the `ImageManager` via constructor: `public function __construct(private ImageManager $image)`. Process images in `handle()` and use `dispatch()` for async execution.
How do I handle memory limits when processing large images (e.g., 10MB+)?
Increase `memory_limit` in `php.ini` or use chunked processing: `Image::make($file)->stream()->resize()->save()`. For APIs, stream responses directly: `return response()->streamDownload($stream, 'image.jpg')`. Test with `ini_set('memory_limit', '512M')` in development.
Can I cache processed images to avoid reprocessing the same file?
Yes, use Laravel’s filesystem (e.g., `storage/app/public`) or a CDN. Implement a cache key like `md5($originalPath.$width.$height)`. For dynamic URLs, append query params: `/images/{hash}?w=300`. Clear cache when originals update.
What Laravel versions are supported, and are there breaking changes?
This package supports Laravel 8+. Breaking changes are rare but may occur with major Intervention Image updates. Check the [changelog](https://github.com/Intervention/image-laravel/blob/main/CHANGELOG.md) for version-specific notes. Test upgrades in a staging environment.
How do I test image processing in PHPUnit without hitting memory limits?
Mock the `ImageManager` in tests: `$this->partialMock(ImageManager::class, ['make'])->willReturn($mockImage)`. Use small test images (e.g., 100x100px) and set `ini_set('memory_limit', '128M')` in `phpunit.xml`. Test edge cases like corrupt files with `Image::make()->exceptionOnNotFound(false)`.
Are there alternatives to this package for Laravel image processing?
Alternatives include `spatie/laravel-image-optimization` (for optimization), `league/glide` (serverless-friendly), or raw Intervention Image. This package is ideal for Laravel-specific needs like facades, response macros, and centralized config. Compare based on your stack (e.g., Glide for cloud storage).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
thomas-0816/doctrine-dbal-duckdb
moyisoft/laravel-admin
oxygen/mod-pages
oxygen/mod-import-export
oxygen/mod-media
ksoft/laravel-contentbuilderjs
ourgoldpackages/exchange
mikkimike/laravel-exchange1c
wandesnet/mercadopago-laravel
tsfcorp/email
larafony/core
laravel-enso/currencies
tartan/laravel-online-payment
gam/laravel-sat-catalogs
cloudcreativity/laravel-stripe
abdulelahragih/querybuilder
wedevbr/celcoin-laravel
surazdott/nepali-date
devsquad-cockpit/laravel
coding-socks/laravel-upload-handler