Пример #1
0
 /**
  * add a given image to the document
  * 
  * @param CezShowimageParameter $params image parameter
  * @param float $x horizontal position
  * @param float $y vertical position
  * @param $w width
  * @param $h height
  * @param $quality image quality
  * @access protected
  */
 function addImage(&$params, $x = 0, $y = 0, $w = 0, $h = 0, $quality = 75)
 {
     if ($params->isUrl()) {
         if (function_exists('imagecreatefrompng')) {
             switch ($params->getImageType()) {
                 case 3:
                     // png
                     $image = imagecreatefrompng($params->getFilename());
                     break;
                 case 2:
                     // jpeg
                     $image = imagecreatefromjpeg($params->getFilename());
                     break;
                 case 1:
                     // gif
                     $image = imagecreatefromgif($params->getFilename());
                     break;
             }
             parent::addImage($image, $x, $y, $params->getWidth(), $params->getHeight());
         }
     } else {
         // check for image type, currently only png and jpeg supported
         switch ($params->getImageType()) {
             case 3:
                 // png
                 parent::addPngFromFile($params->getFilename(), $x, $y, $params->getWidth(), $params->getHeight());
                 break;
             case 2:
                 // jpeg
                 parent::addJpegFromFile($params->getFilename(), $x, $y, $params->getWidth(), $params->getHeight());
                 break;
             case 1:
                 // gif
                 parent::addGifFromFile($params->getFilename(), $x, $y, $params->getWidth(), $params->getHeight());
                 break;
         }
     }
 }