Beispiel #1
0
 /**
  * Add a Watermark Element
  * 
  * @param string $src
  * @param mixed $style
  * @return PHPWord_Section_Image
  */
 public function addWatermark($src, $style = null)
 {
     $image = new PHPWord_Section_Image($src, $style, true);
     if (!is_null($image->getSource())) {
         $rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
         $image->setRelationId($rID);
         $this->_elementCollection[] = $image;
         return $image;
     } else {
         trigger_error('Src does not exist or invalid image type.', E_ERROR);
     }
 }
Beispiel #2
0
 /**
  * Add a by PHP created Image Element
  * 
  * @param string $link
  * @param mixed $style
  * @return PHPWord_Section_MemoryImage
  */
 public function addMemoryImage($link, $style = null)
 {
     $memoryImage = new PHPWord_Section_MemoryImage($link, $style);
     if (!is_null($memoryImage->getSource())) {
         if ($this->_insideOf == 'section') {
             $rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
         } elseif ($this->_insideOf == 'header') {
             $rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $link, $memoryImage);
         } elseif ($this->_insideOf == 'footer') {
             $rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $link, $memoryImage);
         }
         $memoryImage->setRelationId($rID);
         $this->_elementCollection[] = $memoryImage;
         return $memoryImage;
     } else {
         trigger_error('Unsupported image type.');
     }
 }