private function createImage($path) { try { return $this->imagine->open($path); } catch (\Imagine\Exception\Exception $e) { throw InvalidResourceException::invalidImageException($path, $e); } }
public function loadEngine($file, $encoding) { try { $image = $this->imagine->open($file); $gc = new GraphicsContext($this->imagine, $image); $engine = new self($this->imagine, $this->outputFormat, $this->unitConverter); $engine->attachGraphicsContext($gc); return $engine; } catch (\Imagine\Exception\RuntimeException $e) { throw InvalidResourceException::invalidImageException($file, $e); } }
private function createImage($path) { try { $imageType = $this->type; if ($imageType === IMAGETYPE_JPEG || $imageType === IMAGETYPE_JPEG2000) { return new Jpeg($path); } elseif ($imageType === IMAGETYPE_PNG) { return new Png($path); } elseif ($imageType === IMAGETYPE_TIFF_II || $imageType === IMAGETYPE_TIFF_MM) { return new Tiff($path); } else { throw InvalidResourceException::unsupportetImageTypeException($path); } } catch (\ZendPdf\Exception $e) { throw InvalidResourceException::invalidImageException($path, $e); } }