'phpword not able to replace existing image in the docx file
I am trying to replace existing image in the word file using below code. when I save the output file was having old image as it is.
I open the word file and paste the 1.png image then I try to replace 1.png with 2.jpg but it is not doing anything. I have tried to see many solutions but I do not found any permanent good solution.
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($source_file);
$image_path = '2.jpg';
$templateProcessor->setImageValue('1.png', '2.jpg');
$templateProcessor->saveAs('output.docx');
version "phpoffice/phpword": "^0.18.3"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
