/** * @param LayerInterface[] $layers * @param mixed[] $options * @return Image */ public function createImage(array $layers, array $options) { $this->initContents($layers, $options); $contents = $layers[0]->get('final.contents'); $image = new Image(); $image->setContents($contents); return $image; }
/** * @param LayerInterface[] $layers * @param mixed[] $options * @return Image */ public function createImage(array $layers, array $options) { $this->initContents($layers); $contents = $layers[0]->get('gif.contents'); $extracted = $layers[0]->get('gif.extracted'); $frames = count($extracted); $image = new Image(); $image->setContents($contents); $image->addExtras(['total_frames' => $frames]); return $image; }
/** * @return Image * @api */ public function save() { try { $pass = new DelegatingOptionPass(); $this->options = $pass->process($this->options); TranslatedException::init($this->options); TranslatedException::addResourceDir(__DIR__ . '/Resources/translations'); $pass = new DelegatingLayerPass(); $this->layers = $pass->process($this->layers); $engine = new DelegatingEngine(); $image = $engine->getImage($this->layers, $this->options); } catch (TranslatedException $e) { $image = new Image(); $image->setMessage($e->getMessage()); $image->setVerboseMessage($e->getVerboseMessage()); } $this->layers = [0 => null]; return $image; }