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 for app-wide image settings (GD or Imagick). Install via Composer and manage image processing consistently across your Laravel app.

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+ project?
Run `composer require intervention/image-laravel` in your project root. The package auto-registers its service provider, so no additional steps are needed unless you want to publish the config file. For that, use `php artisan vendor:publish --provider="Intervention\Image\Laravel\ServiceProvider"`.
What’s the difference between using this package vs. the standalone Intervention Image library?
This package adds Laravel-specific features like a facade (`Image::`), publishable config (`config/image.php`), and a response macro (`response()->image()`) for streamlined image handling. Standalone Intervention Image requires manual setup without these Laravel integrations.
Can I switch between GD and Imagick drivers dynamically in production?
No, the driver is set in `config/image.php` and must be configured once. However, you can use environment variables or Laravel’s config caching to switch drivers between environments (e.g., dev vs. prod) without code changes.
How do I handle large images (e.g., 50MB+) without hitting PHP memory limits?
Use chunked processing by leveraging Laravel Queues to offload image tasks to background jobs. Alternatively, set `memory_limit` higher in `php.ini` or use Imagick, which is more memory-efficient for complex operations. Monitor memory usage with `ini_get('memory_limit')` in your code.
Does this package support Laravel 10, or is it limited to Laravel 8+?
The package officially supports Laravel 8+. While it may work with Laravel 10 due to backward compatibility, test thoroughly for any facade or macro conflicts. Check the [GitHub issues](https://github.com/Intervention/image-laravel/issues) for updates on newer Laravel versions.
How do I test image processing in PHPUnit without hitting file system or driver issues?
Mock the `Image` facade using Laravel’s mocking helpers: `$this->mock(Image::class)`. For file system tests, use temporary directories with `Storage::fake()`. Test driver-specific logic by overriding the config in `phpunit.xml` or `setUp()` with a custom `config/image.php`.
What happens if neither GD nor Imagick is installed on the server?
The package will throw a `RuntimeException` during boot if no valid driver is configured. To handle this gracefully, catch the exception and return a fallback (e.g., a placeholder image) or log a warning. Shared hosting may require contacting support to enable `php-gd` or `php-imagick`.
Can I use this package in a multi-tenant SaaS app with tenant-specific image settings?
Yes, but you’ll need to override the global config dynamically. Use Laravel’s `config()` helper to merge tenant-specific settings: `config(['image.driver' => $tenant->image_driver])`. Alternatively, bind a custom `ImageManager` instance in your service container for each tenant.
How do I optimize performance for high-traffic image processing (e.g., social media uploads)?
Cache processed images in Redis or a CDN to avoid reprocessing identical requests. Use Imagick for complex operations and enable Laravel’s queue system for background processing. Also, set `image.cache` to `true` in `config/image.php` to cache intermediate results.
Are there alternatives to Intervention Image Laravel for Laravel image processing?
Yes, alternatives include `spatie/laravel-medialibrary` (for file storage + image processing), `laravelista/image` (a Laravel wrapper for ImageMagick), or `spatie/image-optimizer` (for optimization). Choose based on your needs: Intervention Image Laravel is lightweight and driver-flexible, while others offer additional features like storage integration.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation