public function setBackgroundImage(Io_Image $image_) { if (!$image_->exists()) { throw new Io_Exception('io/archive/passbook/generic', sprintf('Given background image does not exist [icon: %s].', Io_Mimetype::IMAGE_PNG(), $image_)); } if (!Io_Mimetype::IMAGE_PNG()->equals($image_->getMimetype())) { throw new Io_Exception('io/archive/passbook/generic', sprintf('Background image must be of type %s [logo: %s].', Io_Mimetype::IMAGE_PNG(), $image_)); } $this->add($image_, self::FILE_BACKGROUND); }
/** * @see \Components\Io_Image_Engine::save() \Components\Io_Image_Engine::save() * * @return \Components\Io_Image_Engine_Gd */ public function save($path_, Io_Mimetype $type_ = null) { if (null === $type_) { $type_ = Io_Mimetype::forFileExtension(Io::fileExtension($path_)); } if (null === $type_) { $type_ = Io_Mimetype::IMAGE_PNG(); } $typeName = $type_->name(); if (false === isset(self::$m_saveHandler[$typeName])) { throw new Exception_NotSupported('io/image/engine/gd', sprintf('Saving to image of requested type is not supported [%s].', $type_)); } $directory = dirname($path_); if (false === is_dir($directory)) { Io::directoryCreate($directory); } $saveHandler = self::$m_saveHandler[$typeName]; $saveHandler($this->m_resource, $path_); return $this; }