private function setDimensionsFromParent(EngineImage $sourceImage, Node $node)
 {
     $parent = $node->getParent();
     $width = $sourceImage->getOriginalWidth();
     $height = $sourceImage->getOriginalHeight();
     if ($width > $parent->getWidth() || $height > $parent->getHeight()) {
         if ($parent->getWidth() > $parent->getHeight()) {
             $height = $parent->getHeight();
             $width = null;
         } else {
             $width = $parent->getWidth();
             $height = null;
         }
     }
     return array($width, $height);
 }
Esempio n. 2
0
 protected function doDrawImage(BaseImage $image, $x1, $y1, $x2, $y2)
 {
     $zendImage = $image->getWrappedImage();
     $this->getPage()->drawImage($zendImage, $x1, $y1, $x2, $y2);
 }
Esempio n. 3
0
 protected function doDrawImage(BaseImage $image, $x1, $y1, $x2, $y2)
 {
     $height = $y2 - $y1;
     $width = $x2 - $x1;
     $imagineImage = $image->getWrappedImage();
     $box = $imagineImage->getSize();
     $drawedImageHeight = $box->getHeight();
     $drawedImageWidth = $box->getWidth();
     if ($height != $drawedImageHeight || $width != $drawedImageWidth) {
         $newBox = new Box($width, $height);
         $imagineImage->resize($newBox);
     }
     $y = $this->convertYCoord($y1 + $height);
     list($image, $point) = $this->getCurrentClip();
     $image->paste($imagineImage, $this->translatePoint($point, $x1, $y));
 }
Esempio n. 4
0
 protected function doDrawImage(BaseImage $image, $x1, $y1, $x2, $y2)
 {
     $requestedHeight = $y2 - $y1;
     $requestedWidth = $x2 - $x1;
     /**
      * @var ImageInterface $imagineImage
      */
     $imagineImage = $image->getWrappedImage();
     $box = $imagineImage->getSize();
     $imageHeight = $box->getHeight();
     $imageWidth = $box->getWidth();
     if ($requestedHeight != $imageHeight || $requestedWidth != $imageWidth) {
         $newBox = new Box($requestedWidth, $requestedHeight);
         $imagineImage->resize($newBox);
     }
     $y = $this->convertYCoord($y2);
     /**
      * @var ImageInterface $image
      */
     list($image, $basePoint) = $this->getCurrentClip();
     $point = $this->translatePoint($basePoint, $x1, $y);
     $this->pasteImage($image, $imagineImage, $point);
 }