How can I insert an image inside a cloneBlock using PHPWord template processor

Viewed 30

I have this in the docx template:

${evidence}
${date}
${image:720:480}
${/evidence}

I'm trying to set a string and an image that's on the local server inside a codeblock, the string gets replaced well but the image doesn't get inserted, it only shows the path to the image.

PHP code:

$filepath = './uploads/image.png';
$replacements = array(
            array('date' => '25-06-2022', 'image' => $filepath),
        );
$templateProcessor->cloneBlock('evidence', 0, true, false, $replacements);

Output in the docx file:

25-06-2022
./uploads/image.png

I'm using PHPWord 0.18.3 and PHP 8.1.

0 Answers
Related