Intervention / image

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

feature/better input handler #1250

Closed olivervogel closed 9 months ago

olivervogel commented 10 months ago

Addresses #361

Code Example of new features

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;
use Intervention\Image\Decoders\DataUriImageDecoder;
use Intervention\Image\Decoders\Base64ImageDecoder;
use Intervention\Image\Decoders\FilePathImageDecoder;

// create new manager instance with desired driver
$manager = new ImageManager(new Driver());

// read image only from data uri or base64 encoded data
$image = $manager->read($input, [
    DataUriImageDecoder::class,
    Base64ImageDecoder::class,
]);

// read image only from file path
$image = $manager->read($input, FilePathImageDecoder::class);

// same with object instead of class name
$image = $manager->read($input, new FilePathImageDecoder());