Unable to add <img> tag to Html element
Describe the Bug
I'm trying to create a <table> element and add it as Html to my document.
In one of the rows I have to add an <img> tag, but I'm unable to do so. Does the library support this functionality?
Steps to Reproduce
<?php
$html .= '<table><tr><td style="width: 50px;"><img src="https://i.imgur.com/Pxh2zYA.jpg" alt="" width="15" height="15"></td></tr></table>';
\PhpOffice\PhpWord\Shared\Html::addHtml($cellTable1Cell3, $html, false, true);
// Save the document
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('/Users/guest/Desktop/testphpword/result/test.docx');
Expected Behavior
I expected the image to show up on the row.
Current Behavior
On document creation I get the following error:
Warning: DOMDocument::loadXML(): Opening and ending tag mismatch
I've tried closing the image tag like this:
<img src="https://i.imgur.com/Pxh2zYA.jpg" alt="" width="15" height="15" />
The warning doesn't show up but I'm unable to open the generated document because it throws an error.
Context
- PHP Version: 7.3.33
- PHPWord Version: ^0.18.2
You should debug parseImage on PhpWord\Shared\Html.php
It seems the https://i.imgur.com/Pxh2zYA.jpg content can be downloaded to this part of code.