Partial Blur Filter for Intervention/Image package
<?php
namespace Maiorano\Services\Filters;
use Intervention\Image\Filters\FilterInterface;
use Intervention\Image\Image;
class PartialBlurFilter implements FilterInterface
{
private $width;
private $height;
private $x;
private $y;
public function __construct($width, $height, $x = 0, $y = 0)
{
$this->width = $width;
$this->height = $height;
$this->x = $x;
$this->y = $y;
}
public function applyFilter(Image $image)
{
$crop = clone $image;
$crop->crop($this->width, $this->height, $this->x, $this->y)->blur(100);
$image->insert($crop, 'top-left', $this->x, $this->y);
return $image;
}
}