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

Intervention/image

View on GitHub

Description

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

Testing in Laravel 13 For Beginners

26 lessons
1 h 41 min read

How to Build Laravel 13 API From Scratch

30 lessons
1 h 23 min

How to Structure Laravel 13 Projects

16 lessons
1 h 32 min read

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.