Forum


Replies: 2   Views: 2676
Replacetablevariable doesn't render <img> tag
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 therasim  · 23-02-2017 - 17:36

I'm using 6.5 version of PHPDocX, and I have a method that cleans a piece of HTML and then perfoms the following

// As an example: 
for ($i = 0; $i < 20; $i++) {
   $html = '<img src="/var/www/images/image.jpg"><p>This is a test</p>';

   $element = new WordFragment($docx);
   $element->embedHTML($html);

   $table['elements][] = [
     'name' => 'Test',
     'description' => element,
   ];
}

// Later in the code
$docx->replaceTableVariable($table['elements'], ['firstMatch' => true]);

When I generate the code I can't see the image. The image has permissions to be read/write. If I switch and try to use addImage() method, PHPDocX complains that the image doesn't exist. Any hints on how to fix this, please?

Thanks in advance,