/** * Add a Image Element * * @param string $src * @param mixed $style * @return PHPWord_Section_Image */ public function addImage($src, $style = null) { require_once __DIR__ . '/Image.php'; $image = new Document_Word_Writer_Section_Image($src, $style); if (!is_null($image->getSource())) { $rID = Document_Word_Writer_Media::addFooterMediaElement($this->_footerCount, $src); $image->setRelationId($rID); $this->_elementCollection[] = $image; return $image; } else { trigger_error('Src does not exist or invalid image type.', E_ERROR); } }
/** * Add a Image Element * * @param string $src * @param mixed $style * @return PHPWord_Section_Image */ public function addImage($src, $style = null) { require_once __DIR__ . '/../Image.php'; $image = new Document_Word_Writer_Section_Image($src, $style); if (!is_null($image->getSource())) { require_once __DIR__ . '/../../Media.php'; if ($this->_insideOf == 'section') { $rID = Document_Word_Writer_Media::addSectionMediaElement($src, 'image'); } elseif ($this->_insideOf == 'header') { $rID = Document_Word_Writer_Media::addHeaderMediaElement($this->_pCount, $src); } elseif ($this->_insideOf == 'footer') { $rID = Document_Word_Writer_Media::addFooterMediaElement($this->_pCount, $src); } $image->setRelationId($rID); $this->_elementCollection[] = $image; return $image; } else { trigger_error('Source does not exist or unsupported image type.'); } }
public static function staticAddImage($th, $src, $style = null) { require_once __DIR__ . '/Section/Image.php'; require_once __DIR__ . '/Media.php'; $image = new Document_Word_Writer_Section_Image($src, $style); if (is_null($image->getSource())) { return false; trigger_error('Source does not exist or unsupported image type.'); } $rID = Document_Word_Writer_Media::addSectionMediaElement($src, 'image'); $image->setRelationId($rID); $th->_elementCollection[] = $image; return $image; }
/** * Add a Watermark Element * * @param string $src * @param mixed $style * @return PHPWord_Section_Image */ public function addWatermark($src, $style = null) { $image = new Document_Word_Writer_Section_Image($src, $style, true); if (!is_null($image->getSource())) { $rID = Document_Word_Writer_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); } }