eZ\Bundle\EzPublishCoreBundle\Imagine\Filter\Loader\CropFilterLoader::load PHP Method

load() public method

public load ( Imagine\Image\ImageInterface $image, array $options = [] )
$image Imagine\Image\ImageInterface
$options array
    public function load(ImageInterface $image, array $options = array())
    {
        if (count($options) < 4) {
            throw new InvalidArgumentException('Invalid options for geometry/crop filter. You must provide array(width, height, offsetX, offsetY)');
        }
        return $this->innerLoader->load($image, array('size' => array($options[0], $options[1]), 'start' => array($options[2], $options[3])));
    }

Usage Example

 public function testLoad()
 {
     $width = 123;
     $height = 789;
     $offsetX = 100;
     $offsetY = 200;
     $image = $this->getMock('\\Imagine\\Image\\ImageInterface');
     $this->innerLoader->expects($this->once())->method('load')->with($image, array('size' => array($width, $height), 'start' => array($offsetX, $offsetY)))->will($this->returnValue($image));
     $this->assertSame($image, $this->loader->load($image, array($width, $height, $offsetX, $offsetY)));
 }
CropFilterLoader