Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.79k stars 1.5k forks source link

Configuration API #1350

Closed olivervogel closed 1 month ago

olivervogel commented 2 months ago

Available Configuration Options

Currently the following options are available.

Name Type Description
autoOrientation bool (optional) Decides whether the image should be automatically aligned based on the Exif data. Default: true
decodeAnimation bool (optional) Whether a possibly animated image is decoded as such or whether the animation is discarded. Default: true
blendingColor bool (optional) The default blending color. Default: ffffff

Apply Configuration Options

Configuration options can be set in three different ways in the Intervention\Image\ImageManager::class.

Option 1. Add configuration options to the ImageManager constructor

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

$manager = new ImageManager(
    Driver::class,
    autoOrientation: false,
    decodeAnimation: true,
    blendingColor: 'ff5500'
);

Option 2. Add configuration options to the static factory method of ImageManager

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;

$manager = ImageManager::withDriver(
    Driver::class,
    autoOrientation: false,
    decodeAnimation: true,
    blendingColor: 'ff5500'
);

Option 3. Add configuration options to the static driver factory method ImageManager

use Intervention\Image\ImageManager;

// with gd
$manager = ImageManager::gd(
    autoOrientation: false,
    decodeAnimation: true,
    blendingColor: 'ff5500'
);

// or with imagick
$manager = ImageManager::imagick(
    autoOrientation: false,
    decodeAnimation: true,
    blendingColor: 'ff5500'
);