Forum


Replies: 2   Views: 1810
Phpdocx_image issue
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 pwctechnicalsecurity  · 19-10-2019 - 22:33

I am using the EmbedHTML functionality. The following works:

<p><img width='660' src='file:///XXX/public/uploads/images/xx.png'></p>

However, the following does not work:

<phpdocx_image width='660' src='file:///XXX/public/uploads/images/xx.png'/>

What am I missing? As I am using Laravel, can I also include images relative to /index.php?
How can I center the image? Setting imageAlign='center' on phpdocx_image did not seem to work.

Posted by admin  · 20-10-2019 - 09:39

Hello,

We recommend you check the HTML Extended documentation (https://www.phpdocx.com/documentation/introduction/html-extended-to-word-PHP):

Options for each method are added with custom data attributes. You just need to write the option name after the prefix data-. E.g.: data-bold="true", data-type="start" o data-type="default".

You are not using the attributes correctly, you need to set custom data attributes: data-

In the Premium package (examples/Core/embedHTML/sample_6.php) you can find a sample that illustrates how to use phpdocx_image with a custom align:

<phpdocx_image data-src="../../img/image.png" data-imageAlign="center" data-scaling="50" />

Regards.

Posted by pwctechnicalsecurity  · 20-10-2019 - 10:42

Spot on! Should work to late on this stuff, concentration goes down the drain.

Thanks for the swift response.