Pop\Pdf\Parser\Image::getOrigH PHP Метод

getOrigH() публичный Метод

Method to get the original image height.
public getOrigH ( ) : string
Результат string
    public function getOrigH()
    {
        return $this->origH;
    }

Usage Example

Пример #1
0
 /**
  * Method to add an image to the PDF.
  *
  * @param  string  $image
  * @param  int     $x
  * @param  int     $y
  * @param  mixed   $scl
  * @param  boolean $preserveRes
  * @throws Exception
  * @return \Pop\Pdf\Pdf
  */
 public function addImage($image, $x, $y, $scl = null, $preserveRes = true)
 {
     if (array_key_exists($image, $this->images) && $preserveRes) {
         $i = $this->lastIndex($this->objects) + 1;
         $co_index = $this->images[$image]['index'];
         if (null !== $scl) {
             $dims = Parser\Image::getScaledDimensions($scl, $this->images[$image]['origW'], $this->images[$image]['origH']);
             $imgWidth = $dims['w'];
             $imgHeight = $dims['h'];
         } else {
             $imgWidth = $this->images[$image]['origW'];
             $imgHeight = $this->images[$image]['origH'];
         }
         $this->objects[$this->objects[$this->pages[$this->curPage]]->curContent]->setStream("\nq\n" . $imgWidth . " 0 0 " . $imgHeight . " {$x} {$y} cm\n/I{$co_index} Do\nQ\n");
         $this->objects[$this->objects[$this->pages[$this->curPage]]->index]->xobjs[] = $this->images[$image]['xobj'];
     } else {
         // Create image parser object
         $i = $this->lastIndex($this->objects) + 1;
         $imageParser = new Parser\Image($image, $x, $y, $i, $scl, $preserveRes);
         $imageObjects = $imageParser->getObjects();
         foreach ($imageObjects as $key => $value) {
             $this->objects[$key] = $value;
         }
         // Add the image to the current page's xobject array and content stream.
         $this->objects[$this->objects[$this->pages[$this->curPage]]->index]->xobjs[] = $imageParser->getXObject();
         $co_index = $this->getContentObject();
         $this->objects[$co_index]->setStream($imageParser->getStream());
         if ($preserveRes) {
             $this->images[$image] = array('index' => $i, 'origW' => $imageParser->getOrigW(), 'origH' => $imageParser->getOrigH(), 'xobj' => $imageParser->getXObject());
         }
     }
     return $this;
 }