/** * {@inheritdoc} */ public function animate(array $frames, $delay = 20) { $gif = new \Imagick(); $gif->setFormat('gif'); foreach ($frames as $im) { if ($im instanceof Imanee) { $frame = $im->getResource()->getResource(); } else { $frame = new \Imagick($im); } $frame->setImageDelay($delay); $gif->addImage($frame); } $imagickResource = new ImagickResource(); $imagickResource->setResource($gif); $imanee = new Imanee(); $imanee->setResource($imagickResource); $imanee->setFormat('gif'); return $imanee; }
/** * @expectedException Imanee\Exception\UnsupportedMethodException */ public function testAnimateShouldThrowExceptionIfNotSupported() { $dummy = $this->getMock('Imanee\\Model\\ImageResourceInterface'); $this->model->setResource($dummy); $this->model->animate(); }