Weave Code
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. Adds a service provider, facade, and publishable config so you can set a global GD or Imagick driver once and use it throughout your app. Supports Laravel 8+.

View on GitHub
Deep Wiki
Context7

Laravel Integration for Intervention Image

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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony