Hello,
Yes, you can replace template text variables with images using replaceVariableByWordFragment.
On https://www.phpdocx.com/documentation/practical/pictures-and-images you can read more information about this feature. For example:
$image = new WordFragment($docx, 'document');
$image->addImage(array('src' => 'image.png' , 'scaling' => 50, 'float' => 'right', 'textWrap' => 1));
$docx->replaceVariableByWordFragment(array('IMAGE' => $image), array('type' => 'block'));
If you need to fill a table with replaceTableVariable you can add WordFragments as new contents:
$image = new WordFragment($docx);
$imageOptions = array(
'src' => 'image.png',
'scaling' => 50,
);
$image->addImage($imageOptions);
$data = array(
array(
'ITEM' => $link1,
'REFERENCE' => $image,
'PRICE' => '5.45'
),
array(
'ITEM' => $link2,
'REFERENCE' => $image,
'PRICE' => '30.12'
),
array(
'ITEM' => $link3,
'REFERENCE' => $image,
'PRICE' => '7.00'
)
);
$docx->replaceTableVariable($data);
Please check the samples included in the package (Templates/replaceTableVariable folder).
On https://www.phpdocx.com/documentation/practical/wordfragments-and-wordml you can read more information about WordFragments.
Regards.