Upgrade Guide

Upgrade from Intervention Image 1.x to 2.x

2.9M Downloads / Month

Open Source MIT License

You are viewing the documentation for Intervention Image 2, this version has reached EOL. Please consider upgrading to version 3.

Although I tried to keep the update to Version 2.x of Intervention Image as compatible as possible, some things have changed. Some methods became redundant, other things have been simplified and therefore had to change.

New Features

  • Additional support of PHP's Imagick extension
  • Sharpening Images
  • Auto Orientating
  • Image Filter architecture

In order to keep your application compatible, you need to keep in mind the following changes, when upgrading.

New Methods

  • width() retrieves current width of image.
  • height() retrieves current height of image.
  • sharpen() applies sharpen filter to image.
  • orientate() auto-adjusts image orientation.
  • filter() applies filter to an image.
  • getCore() get resource of image driver (Imagick object or GD resource).

API changes

Changed Method names

  • fit() replaces the old grab() method.

Changed Arguments on methods

  • Method gamma() now only accepts one argument for gamma correction.
  • Changed arguments for resize() method. Now uses callback to define further options.
  • Changed arguments for circle() method. Now uses callback to define further options.
  • Changed arguments for ellipse() method. Now uses callback to define further options.
  • Changed arguments for line() method. Now uses callback to define further options.
  • Changed arguments for rectangle() method. Now uses callback to define further options.

Removed methods

  • open() no longer exists, use make() instead.
  • raw() no longer exists, use make() instead.
  • grayscale() no longer exists, use greyscale() instead.

Removed properties

  • width property has been removed, use width() instead.
  • height property has been removed, use height() instead.

Other

  • To keep naming consistent the filename of the configuration file for intervention/imagecache was renamed from config/imagecache.php to config/config.php.
  • For standalone use instantiate objects from Intervention\Image\ImageManagerStatic instead of Intervention\Image\Image. (See example)
Edit