Laravel Intervention Image

  • 14-04-2022
  • Laravel 6
  • Haresh Chauhan

Watch Youtube Video (HINDI) :

Hi, Artisan

Hello Friends,In this post you are learn how to create Intervention Image in laravel as well as How to fit image and resizing image in laravel with custom size with using Intervention Image Library.

It provides an easier and expressive way to create, edit, and compose images and supports currently the two most common image processing libraries and It will help to create a custom image with custom height and width or resizing do many more.

Before you Start Installation below Configuration must Required

Following Intervention Image requires components to work correctly.

  • PHP >= 5.4
  • Fileinfo Extension

And one of the following image libraries.

  • GD Library >=2.0
  • or
  • Imagick PHP extension >=6.5.7

Getting start Installation

  • Install your Laravel Project
  • Set MySQL database
  • Install Intervention Image Package
  • Set Intervention Image Configuration
  • Make Controller

Step 1 : Install your Laravel Project

Open your command prompt and fire this below command.

composer create-project --prefer-dist laravel/laravel Intervention Image

After, clone laravel project directory we move on 2nd step.

Step 2 : Set MySQL database

Here we must need to configure .env file so let's do that.


DB_PASSWORD='Set your password'

Now we follow below command for migrate database.

php artisan migrate

Step 3 : Install Intervention Image Package

Open Your Command Prompt and go on Your Exist Project and Put the following command it will take 5-10 minutes of installation.

composer require intervention/image

Using above command we install Intervention Image library in your project.

How to use Date Format Validation in Laravel?

Step 4 : Set Intervention Image Configuration

After you have installed Intervention Image, open your Laravel config file config/app.php and add the following lines.


Here, we need to set Intervention Image library in our laravel project directory config file into provides alias.

'providers' => [

'aliases' => [
  'Image' => Intervention\Image\Facades\Image::class

After put above Providers laravel will auto-loaded Image Class

Put above line into right place.

We have installed package successfully.

Now we are ready to make image.

Note : Before Use you have to put Define usage like Use Image Above Of the Controller without defined it will not work.

Step 5 : Create Controller

We have need to make Controller in your Project by following command.

php artisan make:controller ImageController.

Step 6 : Create blade file


<form action="{{ route('image') }}" method="post" enctype="multipart/form-data">
  <input type="file" name="image">
  <button type="submit">Create Image</button>

How to Add Bootstrap in Angular 8 | Install Bootstrap 4 in Angular 8

Step 7 : Create Route


Step : 8 Go To controller



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Storage;
use Image;
class ImageController extends Controller
  public function form()
    return view('image');

  public function imageCreate(Request $request)
      'image' => 'required|mimes:jpeg,png,jpg,gif|max:2024',


      $image =  $request->image;
      $path = Storage::disk('public');
      $width = 800;
      $height = 600;
      $name = time().'.'.$image->getClientOriginalExtension();

    return back()->with('success', 'Your images has been successfully Upload');

We always thanks to you for reading our blogs.


Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us


Haresh Chauhan


We Are Also Recommending You :