コード例 #1
0
ファイル: Image.php プロジェクト: zhangxiaoliu/PHPPdf
 private function createImage($path)
 {
     try {
         return $this->imagine->open($path);
     } catch (\Imagine\Exception\Exception $e) {
         throw InvalidResourceException::invalidImageException($path, $e);
     }
 }
コード例 #2
0
ファイル: Engine.php プロジェクト: zhangxiaoliu/PHPPdf
 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);
     }
 }
コード例 #3
0
ファイル: Image.php プロジェクト: zhangxiaoliu/PHPPdf
 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);
     }
 }