Forum


Replies: 2   Views: 218
Cannot set the alt text of an inserted image
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

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.