| @@ 5-24 (lines=20) @@ | ||
| 2 | ||
| 3 | use Modules\Media\Image\ImageHandlerInterface; |
|
| 4 | ||
| 5 | class LimitColors implements ImageHandlerInterface |
|
| 6 | { |
|
| 7 | private $defaults = [ |
|
| 8 | 'count' => 255, |
|
| 9 | 'matte' => null, |
|
| 10 | ]; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Handle the image manipulation request |
|
| 14 | * @param \Intervention\Image\Image $image |
|
| 15 | * @param array $options |
|
| 16 | * @return \Intervention\Image\Image |
|
| 17 | */ |
|
| 18 | public function handle($image, $options) |
|
| 19 | { |
|
| 20 | $options = array_merge($this->defaults, $options); |
|
| 21 | ||
| 22 | return $image->limitColors($options['count'], $options['matte']); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| @@ 5-24 (lines=20) @@ | ||
| 2 | ||
| 3 | use Modules\Media\Image\ImageHandlerInterface; |
|
| 4 | ||
| 5 | class Rotate implements ImageHandlerInterface |
|
| 6 | { |
|
| 7 | private $defaults = [ |
|
| 8 | 'angle' => 45, |
|
| 9 | 'bgcolor' => '#000000', |
|
| 10 | ]; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Handle the image manipulation request |
|
| 14 | * @param \Intervention\Image\Image $image |
|
| 15 | * @param array $options |
|
| 16 | * @return \Intervention\Image\Image |
|
| 17 | */ |
|
| 18 | public function handle($image, $options) |
|
| 19 | { |
|
| 20 | $options = array_merge($this->defaults, $options); |
|
| 21 | ||
| 22 | return $image->rotate($options['angle'], $options['bgcolor']); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||