private function setSizesIfOneOfDimensionIsntSet(Node $node, Document $document)
 {
     if ($this->isImageAndSizesArentSet($node)) {
         $width = $node->getWidth();
         $height = $node->getHeight();
         $source = $node->createSource($document);
         $originalWidth = $source->getOriginalWidth();
         $originalHeight = $source->getOriginalHeight();
         $originalRatio = $originalHeight ? $originalWidth / $originalHeight : 0;
         if (!$width && !$height) {
             list($width, $height) = $this->setDimensionsFromParent($source, $node);
         }
         list($width, $height) = Util::calculateDependantSizes($width, $height, $originalRatio);
         $node->setWidth($width);
         $node->setHeight($height);
     }
 }
Exemple #2
0
 protected final function filterBooleanValue($value)
 {
     return Util::convertBooleanValue($value);
 }
Exemple #3
0
 public function setMetadataValue($name, $value)
 {
     switch ($name) {
         case 'Trapped':
             $value = $value === 'null' ? null : Util::convertBooleanValue($value);
             $this->getZendPdf()->properties[$name] = $value;
             break;
         case 'CreationDate':
         case 'ModDate':
             $value = PdfDocument::pdfDate(strtotime($value));
             $this->getZendPdf()->properties[$name] = $value;
             break;
         case 'Title':
         case 'Author':
         case 'Subject':
         case 'Keywords':
         case 'Creator':
             $this->getZendPdf()->properties[$name] = $value;
             break;
     }
 }
 protected function convertDegreesToRadians(Node $node)
 {
     $rotate = $node->getAttribute('rotate');
     $radians = Util::convertAngleValue($rotate);
     $node->setAttribute('rotate', $radians);
 }
Exemple #5
0
 private function getImageDimension(UnitConverter $converter, $image, Node $node)
 {
     $width = $converter->convertUnit($this->imageWidth);
     $height = $converter->convertUnit($this->imageHeight);
     if (!$width && !$height) {
         return array($image->getOriginalWidth(), $image->getOriginalHeight());
     }
     list($width, $height) = $this->convertPercentageDimension($converter, $node, $width, $height);
     $ratio = $image->getOriginalWidth() / $image->getOriginalHeight();
     list($width, $height) = Util::calculateDependantSizes($width, $height, $ratio);
     return array($width, $height);
 }
 public function setEqualsColumns($flag)
 {
     $flag = Util::convertBooleanValue($flag);
     $this->setAttributeDirectly('equals-columns', $flag);
 }