---
application: "Intervention Image"
version: "Version 2"
status: "eol"
---

# Installation

## Easy installation via Composer




### System Requirements

Intervention Image requires the following components to work correctly.

- PHP >= 5.4
- Fileinfo Extension

And **one of** the following image libraries.

- GD Library (>=2.0) &hellip; **or** &hellip;
- Imagick PHP extension (>=6.5.7)

## Installation

The best way to install Intervention Image is with [Composer](https://getcomposer.org).

To install the legacy version 2, run the following command.

```bash
composer require intervention/image:^2
```

Now your ```composer.json``` has been updated automatically and you're able to require the just created ```vendor/autoload.php``` file to PSR-4 autoload the library.

The next step is to decide, if you want to integrate Intervention Image into the **Laravel framework**. If you want to use the library with Laravel, just skip the following step and continue with the description of [Laravel Integration](#integration-in-laravel).


## Usage

Intervention Image doesn't require Laravel or any other framework at all. If you want to use it as is, you just have to require the composer autoload file to instantiate image objects as shown in the following example.

#### Example

```php
// include composer autoload
require 'vendor/autoload.php';

// import the Intervention Image Manager Class
use Intervention\Image\ImageManager;

// create an image manager instance with favored driver
$manager = new ImageManager(['driver' => 'imagick']);

// to finally create image instances
$image = $manager->make('public/foo.jpg')->resize(300, 200);
```

You might also use the static version of ImageManager as shown in the example below.

#### Static Example

```php
// include composer autoload
require 'vendor/autoload.php';

// import the Intervention Image Manager Class
use Intervention\Image\ImageManagerStatic as Image;

// configure with favored image driver (gd by default)
Image::configure(['driver' => 'imagick']);

// and you are ready to go ...
$image = Image::make('public/foo.jpg')->resize(300, 200);
```


## Integration in Laravel 

Intervention Image has optional support for [Laravel](https://www.laravel.com) and comes with a **Service Provider and Facades** for easy integration. The `vendor/autoload.php` is included by Laravel, so you don't have to require or autoload manually. Just see the instructions below.

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

In the ```$providers``` array add the service providers for this package.

```
Intervention\Image\ImageServiceProvider::class
```

Add the facade of this package to the ```$aliases``` array.

```php
'Image' => Intervention\Image\Facades\Image::class
```

Now the Image Class will be auto-loaded by Laravel.


### Configuration

By default Intervention Image uses PHP's GD library extension to process all images. If you want to switch to Imagick, you can pull a configuration file into your application by running one of the following artisan command.

#### Publish configuration in Laravel

```bash
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravelRecent"
````


#### Publish configuration in Laravel resize(300, 200);
    return $img->response('jpg');
});
```

---

## Become a Sponsor

### Intervention Image needs your help to keep the project going

Intervention Image is non-commercial, open source licensed and completely free to use. The considerable
effort required to maintain and develop the software is only possible with the financial support
of sponsors. There are two ways in which you can support this project.

- Support via [GitHub Sponsors](https://github.com/sponsors/Intervention)
- Support via [Ko-Fi](https://ko-fi.com/interventionphp)