mirror of
https://github.com/Intervention/image.git
synced 2025-08-19 04:01:30 +02:00
Refactor code
This commit is contained in:
@@ -2,15 +2,14 @@
|
||||
|
||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\Gd\Image;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\ModifierInterface;
|
||||
use Intervention\Image\Interfaces\PointInterface;
|
||||
use Intervention\Image\Traits\CanResolveDriverClass;
|
||||
use Intervention\Image\Traits\CanHandleInput;
|
||||
|
||||
class PlaceModifier implements ModifierInterface
|
||||
{
|
||||
use CanResolveDriverClass;
|
||||
use CanHandleInput;
|
||||
|
||||
/**
|
||||
* Create new modifier
|
||||
@@ -27,7 +26,7 @@ class PlaceModifier implements ModifierInterface
|
||||
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$watermark = $this->decodeWatermark();
|
||||
$watermark = $this->handleInput($this->element);
|
||||
$position = $this->getPosition($image, $watermark);
|
||||
|
||||
foreach ($image as $frame) {
|
||||
@@ -47,11 +46,6 @@ class PlaceModifier implements ModifierInterface
|
||||
return $image;
|
||||
}
|
||||
|
||||
protected function decodeWatermark(): Image
|
||||
{
|
||||
return $this->resolveDriverClass('InputHandler')->handle($this->element);
|
||||
}
|
||||
|
||||
protected function getPosition(ImageInterface $image, ImageInterface $watermark): PointInterface
|
||||
{
|
||||
$image_size = $image->getSize()->movePivot($this->position, $this->offset_x, $this->offset_y);
|
||||
|
@@ -4,15 +4,14 @@ namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||
|
||||
use Imagick;
|
||||
use Intervention\Image\Drivers\Imagick\Image;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\ModifierInterface;
|
||||
use Intervention\Image\Interfaces\PointInterface;
|
||||
use Intervention\Image\Traits\CanResolveDriverClass;
|
||||
use Intervention\Image\Traits\CanHandleInput;
|
||||
|
||||
class PlaceModifier implements ModifierInterface
|
||||
{
|
||||
use CanResolveDriverClass;
|
||||
use CanHandleInput;
|
||||
|
||||
public function __construct(
|
||||
protected $element,
|
||||
@@ -25,7 +24,7 @@ class PlaceModifier implements ModifierInterface
|
||||
|
||||
public function apply(ImageInterface $image): ImageInterface
|
||||
{
|
||||
$watermark = $this->decodeWatermark();
|
||||
$watermark = $this->handleInput($this->element);
|
||||
$position = $this->getPosition($image, $watermark);
|
||||
|
||||
foreach ($image as $frame) {
|
||||
@@ -40,11 +39,6 @@ class PlaceModifier implements ModifierInterface
|
||||
return $image;
|
||||
}
|
||||
|
||||
protected function decodeWatermark(): Image
|
||||
{
|
||||
return $this->resolveDriverClass('InputHandler')->handle($this->element);
|
||||
}
|
||||
|
||||
protected function getPosition(ImageInterface $image, Image $watermark): PointInterface
|
||||
{
|
||||
$image_size = $image->getSize()->movePivot($this->position, $this->offset_x, $this->offset_y);
|
||||
|
Reference in New Issue
Block a user