eZ\Bundle\EzPublishCoreBundle\Imagine\Filter\Loader\ScaleWidthDownOnlyFilterLoader::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 (empty($options)) {
            throw new InvalidArgumentException('Missing width option');
        }
        return $this->innerLoader->load($image, array('size' => array($options[0], null), 'mode' => ImageInterface::THUMBNAIL_INSET));
    }

Usage Example

 public function testLoad()
 {
     $width = 123;
     $image = $this->getMock('\\Imagine\\Image\\ImageInterface');
     $this->innerLoader->expects($this->once())->method('load')->with($image, $this->equalTo(array('size' => array($width, null), 'mode' => ImageInterface::THUMBNAIL_INSET)))->will($this->returnValue($image));
     $this->assertSame($image, $this->loader->load($image, array($width)));
 }
ScaleWidthDownOnlyFilterLoader