1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-01 01:51:43 +02:00
This commit is contained in:
Oliver Vogel
2021-10-30 12:16:23 +02:00
parent 72f4e2e6ea
commit e351b68683
3 changed files with 18 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ use GdImage;
use Intervention\Image\Collection;
use Intervention\Image\Drivers\Abstract\AbstractImage;
use Intervention\Image\Drivers\Gd\Frame;
use Intervention\Image\Geometry\Resizer;
use Intervention\Image\Geometry\Size;
use Intervention\Image\Interfaces\EncoderInterface;
use Intervention\Image\Interfaces\ImageInterface;
@@ -23,4 +24,12 @@ class Image extends AbstractImage implements ImageInterface, IteratorAggregate
{
return imagesy($this->frames->first()->getCore());
}
public function resize(...$arguments): self
{
$resizer = new Resizer($this->size());
$resizer->setTargetSizeByArray($arguments)->resize();
return $this;
}
}

View File

@@ -9,10 +9,10 @@ class GreyscaleModifier implements ModifierInterface
{
public function apply(ImageInterface $image): ImageInterface
{
foreach ($this->image as $frame) {
foreach ($image as $frame) {
$frame->getCore()->modulateImage(100, 0, 100);
}
return $this->image;
return $image;
}
}

View File

@@ -43,4 +43,11 @@ class ImageTest extends TestCase
{
$this->assertInstanceOf(Size::class, $this->image->size());
}
public function testResize(): void
{
$this->assertInstanceOf(Image::class, $this->image->resize(function ($size) {
$size->width(300);
}));
}
}