Hello,
The addImage method adds a new image, it doesn't replace a text placeholder or an existing image in a DOCX template.
You need to use replacePlaceholderImage to replace an existing image that includes a placeholder added as alternative text. Or replaceVariableByWordFragment to replace a text placeholder by a new image.
On the following practical guide: Pictures and images , and the API documentation pages of the methods you can find further information and samples. You can also find more samples in the package.
Also note the following:
- Adding a stream with addImage may require enabling the streamMode available in the method. As detailed on the API documention pages:
src
The path to the image or base64 string or stream to be inserted into the Word document. If a stream is added, use with the streamMode option.
- If the URL uses HTTPs please check that the PHP settings are correct and can download the image correctly. On https://www.phpdocx.com/documentation/cookbook/insert-images-html (From HTTPS section) you can read more information about this.
Regards.