Skip to main content
Back to packages
14,338 GitHub stars

Intervention/image

View on GitHub

Description

Not only Laravel, but a general PHP package: image handling and manipulation library

Intervention Image can be easily integrated into a Laravel application with the official integration package. This package provides a Laravel service provider, facade, a publishable configuration file and more.

Static Facade Interface

This package also integrates access to Intervention Image's central entry point, the ImageManager::class, via a static facade. The call provides access to the centrally configured image manager via singleton pattern.

The following code example shows how to read an image from an upload request the image facade in a Laravel route and save it on disk with a random file name.

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Intervention\Image\Laravel\Facades\Image;
 
Route::get('/', function (Request $request) {
$upload = $request->file('image');
$image = Image::decode($upload)
->resize(300, 200);
 
Storage::put(
Str::random() . '.' . $upload->getClientOriginalExtension(),
$image->encodeUsingFileExtension($upload->getClientOriginalExtension(), quality: 70)
);
});

Recent Courses on Laravel Daily

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.