Esempio n. 1
0
 /**
  * @covers Imagine\Filter\Basic\Crop::apply
  *
  * @dataProvider getDataSet
  *
  * @param PointInterface $start
  * @param BoxInterface   $size
  */
 public function testShouldApplyCropAndReturnResult(PointInterface $start, BoxInterface $size)
 {
     $image = $this->getImage();
     $command = new Crop($start, $size);
     $image->expects($this->once())->method('crop')->with($start, $size)->will($this->returnValue($image));
     $this->assertSame($image, $command->apply($image));
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function load(ImageInterface $image, array $options = array())
 {
     list($x, $y) = $options['start'];
     list($width, $height) = $options['size'];
     $filter = new Crop(new Point($x, $y), new Box($width, $height));
     $image = $filter->apply($image);
     return $image;
 }
Esempio n. 3
0
 /**
  * @param ImagineImageInterface $image
  *
  * @return ImagineImageInterface
  */
 public function updateFile(ImagineImageInterface $image)
 {
     $this->originWidth = $image->getSize()->getWidth();
     $this->originHeight = $image->getSize()->getHeight();
     // Resize
     $this->resize();
     $resize = new ImagineResize(new Box($this->resizeWidth, $this->resizeHeight));
     $image = $resize->apply($image);
     // Crop
     $this->crop();
     $crop = new ImagineCrop(new Point($this->targetLeft, $this->targetTop), new Box($this->targetWidth, $this->targetHeight));
     $image = $crop->apply($image);
     return $image;
 }