Im trying to replace an image in my document using the replacePlaceHolderImage function.
I've inserted an image in my document, and set the ALT TEXT property of the image to "logo" as is stated in the documentation of PHPDocX.
I'm then trying to replace it by writing:
$docx->replacePlaceholderImage('logo','tmp/'.$filename);
But nothing happens and the image is still my placeholder image ..
What am I doing wrong here ?
Well I did some more research and came up with the solution.
First i make my property array which makes sure that the width and height is set to auto for my inserted image.
Then i call the replacePlaceholderImage as follows:
Note the 'LOGO' variable which must be set for my image in the docx document which is used as the template. In Word2013 you need to select the placeholder image -> right click -> format picture -> Select layout and properties -> Select ALT TEXT and insert the variable name in the "Description" field. In my example is set it to $LOGO$.
This is also where i mis-read the documentation, as I set the Title property instead.
Works like a charm..