Configuration

  • GD
  • Imagick

Make sure you have one of these installed in your PHP environment, before you start.

You’re able to configure Intervention Image to use one of these libraries for all its operations. Just pass the configuration as an array directly into the ImageManager.

Example

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

Static Example

  1. require 'vendor/autoload.php';
  2. // import the Intervention Image Manager Class
  3. use Intervention\Image\ImageManagerStatic as Image;
  4. // configure with favored image driver (gd by default)
  5. Image::configure(array('driver' => 'imagick'));
  6. // and you are ready to go ...

If you’re using Laravel, you can pull a configuration file into your application by running the following artisan command.

Publish configuration in Laravel 5

Publish configuration in Laravel 4

In Laravel 5 applications the configuration file is copied to config/image.php, in older Laravel 4 applications you will find the file at app/config/packages/intervention/image/config.php. With this copy you can alter the image driver settings for you application locally and define which library should be used by all commands..

Currently you can choose between gd and imagick support.


Memory Settings

The following php.ini directives are important.

Sets a maximum amount of memory in bytes that a script is allowed to allocate. Resizing a 3000 x 2000 pixel image to 300 x 200 may take up to 32MB memory.

upload_max_filesize

If you’re planing to upload large images, verify that this setting for the maximum size of file uploads fits your needs.

Read more in the official PHP documentation for: