Forum


Replies: 3   Views: 1280
Images embedded in html are not reflecting in docx
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 jacquesduff  · 30-07-2021 - 15:05

Hi There,

I'm using "embedHTML" method of PHPDocx8 in php-version 7.3. Images included in the HTML are not showing in the created document. Earlier, it used to be worked properly.

The image permissions on the server are fine. Even, I tried it with different extensions png, jpg.

Here is the code:

$docx = new CreateDocxFromTemplate(getcwd() . $clinicLetterheadPath);
$letter_data = '<span id="letter_date">31/07/2021</span><br />
Test Document 
<p><img src="https://domain-name.com/editor/uploads/test.jpg" /></p>
<h6>Signatures</h6>';
$letter_data = '<style>p {margin: 0px; padding: 0px; font-weight: normal;}</style>' . $letter_data;
$letter_options = array(
  'useHTMLExtended' => true,
  'downloadImages' => true,
  'parseDivs' => 'paragraph',
);
$docx->embedHTML($letter_data, $letter_options);
$path = getcwd() . "/pdftemp/";
$filepath = $path . $filename;
$docx->createDocx($filepath);

Can someone please suggest if there is in-compatibility with the PHP upgraded version? How we can debug it? There are no logs in the package directory!

Thanks