Forum


Replies: 2   Views: 193
Cannot set the alt text of an inserted image

Posted by ninof  · 27-08-2024 - 01:18

Hi,
I need to insert a QRCode image with an Alt Text using replaceVariableByHTML.

The php code I am using is:

//////
$sValue="<p>Click here.. <img src='https://dmy.com/tmp/qrcode.png' alt='|img_qrcode|'></p>"
$docx->replaceVariableByHTML('myField','block',$sValue,array('isFile'=>false,'parseFloats'=>true,'downloadImages'=>true,'parseDivs'=>'paragraph'));
//////

The image is output correctly but it's Alt Text is not being set. Instead it is the image name ie 'qrcode.png'

Can you please advise how I can get this to work.
Thanks.