Forum


Replies: 6   Views: 1534
Insert image stream with embedhtml
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 hotspot22  · 22-07-2020 - 12:38

Hi,

I have a problem with inserting image streams into my docx when using url get parameter.

The following with direct url to image file is working correctly:

$docx = new CreateDocx();
$html = '<img src="https://www.mydomain.com/images/test.png">';
$docx->embedHTML($html);

Also this block with referencing a php file is working fine:

$docx = new CreateDocx();
$html = '<img src="https://www.mydomain.com/image.php">';
$docx->embedHTML($html);

In my test example the content of my image.php is:

<?php
echo file_get_contents('/images/test.png');

But now my problem comes with this code:

$docx = new CreateDocx();
$html = '<img src="https://www.mydomain.com/image.php?id=123">'; // adding ?id=123
$docx->embedHTML($html);

My image.php is not changed and should output my test image.

I've only added the get parameter id=123 to the url and with this change, the image is no longer shown in the document. Instead there is only a border with a red cross in the upper left corner and an error message saying that the image can't be displayed.

?????? Any suggestions?