Commit a76ec264 authored by Nicolas Widart's avatar Nicolas Widart

Adding trim implementation

parent f6adaad4
......@@ -58,8 +58,11 @@ return [
// 'rotate' => [
// 'angle' => -45
// ],
'sharpen' => [
'amount' => 30
// 'sharpen' => [
// 'amount' => 30
// ],
'trim' => [
'base' => 'top-left',
],
]
];
<?php namespace Modules\Media\Image\Intervention\Manipulations;
use Modules\Media\Image\ImageHandlerInterface;
class Trim implements ImageHandlerInterface
{
private $defaults = [
'base' => 'top-left',
'away' => ['top', 'bottom', 'left', 'right'],
'tolerance' => 0,
'feather' => 0,
];
/**
* 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->trim($options['base'], $options['away'], $options['tolerance'], $options['feather']);
}
}
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