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+.
Starting with version 13.20, Laravel introduced its own image integration based on Intervention Image. Unfortunately, this led to naming conflicts with facades and configuration files if you had installed intervention/image-laravel.
This update resolves these issues, but it also includes significant changes.
image to intervention.imageimage.php to intervention-image.phpIf you're using intervention/image-laravel with Laravel 13.20, I recommend updating to version 4.1.0 immediately.
To avoid future problems with the configuration file, I recommend renaming the file from config/image.php to config/intervention-image.php after the update. However, this is not strictly necessary the legacy config is still detected by a fallback.
In the rather unlikely event that the image manger is resolved via an app('image') call, the new naming convention should be used: app('intervention.image').
Full Changelog: https://github.com/Intervention/image-laravel/compare/4.0.1...4.1.0
Intervention\Image\ImageManager::class and Intervention\Image\Interfaces\ImageManagerInterface as configured singletons.Code Example:
use Intervention\Image\Interfaces\ImageManagerInterface;
class ImageController extends Controller
{
/**
* Create a new controller instance.
*/
public function __construct(
protected ImageManagerInterface $imageManager,
) {}
/**
* Store a new Image.
*/
public function store(Request $request): RedirectResponse
{
$image = $this->imageManager->decode($request->image);
// image manipulation ...
return redirect('/images');
}
}
4.0.0 to support new Intervention Image v4.0.0Full Changelog: https://github.com/Intervention/image-laravel/compare/1.5.7...1.5.8
Full Changelog: https://github.com/Intervention/image-laravel/compare/1.5.6...1.5.7
Full Changelog: https://github.com/Intervention/image-laravel/compare/1.5.5...1.5.6
ImageResponseFactory::classFull Changelog: https://github.com/Intervention/image-laravel/compare/1.5.3...1.5.4
Full Changelog: https://github.com/Intervention/image-laravel/compare/1.5.1...1.5.2
The package now includes a Laravel response macro that can be used to elegantly encode image resources and convert it to an HTTP response in a single step.
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Format;
use Intervention\Image\Laravel\Facades\Image;
Route::get('/', function () {
$image = Image::read(Storage::get('example.jpg'))
->scale(height: 300);
return response()->image($image, Format::WEBP, quality: 65);
});
Full Changelog: https://github.com/Intervention/image-laravel/compare/1.4.0...1.5.0
The package now includes a Laravel response macro that can be used to elegantly encode image resources and convert it to an HTTP response in a single step.
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Format;
use Intervention\Image\Laravel\Facades\Image;
Route::get('/', function () {
$image = Image::read(Storage::get('example.jpg'))
->scale(height: 300);
return response()->image($image, Format::WEBP, quality: 65);
});
Full Changelog: https://github.com/Intervention/image-laravel/compare/1.4.0...1.5.0
Full Changelog: https://github.com/Intervention/image-laravel/compare/1.3.0...1.4.0
How can I help you explore Laravel packages today?