Replacing images in a Word template with PHPdocx

  • Jun 06, 2011

This information is outdated, please, refer to the addTemplateImage method documentation for up to date info.
You may create a template with placeholder images that may be later replaced by other ones with the help of the addTemplateImage method.
In order that PHPDocX recognizes which image should be replace you need to introduce a PHPDocX variables as its associated 'Alt text'.
Sample code:

require_once '../../classes/';

$objDocx = new CreateDocx();

// Call the template

// Call the image
$objDocx->addTemplateImage('IMAGE', '../files/img/logo_phpdocx.gif');