Commit 0e2ad262 authored by Nicolas Widart's avatar Nicolas Widart

Adding colorize implementation

parent 5e4b9739
......@@ -4,20 +4,23 @@ return [
'smallThumb' => [
// 'crop' => [
// 'width' => '100',
// 'height' => '200'
// ],
// 'fit' => [
// 'width' => '100',
// 'height' => '200',
// 'x' => 0,
// 'y' => 0
// 'position' => 'top-left'
// ],
'fit' => [
'width' => '100',
'height' => '200',
'position' => 'top-left'
],
// 'blur' => [
// 'amount' => '15'
// ],
'brightness' => [
'level' => '50'
],
// 'brightness' => [
// 'level' => '50'
// ],
'colorize' => [
'red' => 0,
'green' => 0,
'blue' => 99
]
]
];
<?php namespace Modules\Media\Image\Intervention\Manipulations;
use Modules\Media\Image\ImageHandlerInterface;
class Colorize implements ImageHandlerInterface
{
private $defaults = [
'red' => 100,
'green' => 100,
'blue' => 100,
];
/**
* Handle the image manipulation request
* @param \Intervention\Image\Image $image
* @param array $options
* @return \Intervention\Image\Image
*/
public function handle($image, $options)
{
$options = array_merge($this->defaults, $options);
return $image->colorize($options['red'], $options['green'], $options['blue']);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment