Forum


Replies: 2   Views: 1150
Issue with images from
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 s.montanarella  · 18-06-2021 - 15:01

I've problem with images inside table:

<table class="alert" cellspacing="0" width="642" style="table-layout: fixed;">
<tbody>
<tr>
<td width="114" style=""><p class="Intestazionecolonnatabella"><img src="/documents/VersUploadManuals/832/ATTENZIONE_100_100.jpg" width="100"></p></td>
<td class="lrt" width="528" style=""><p class="Messaggiosicurezzaintegrato">msg<br><br></p></td>
</tr>
<tr>
<td width="114" style=""><p class="Intestazionecolonnatabella"><img src="/documents/VersUploadManuals/832/ATTENZIONE_100_100.jpg" width="100"></p></td>
<td class="lrt" width="528" style=""><p class="Messaggiosicurezzaintegrato">msg<br><br></p></td>
</tr>
</tbody>
</table>

This works, images correctly visualized in the docx.

Instead these images are not present in the docx.

<table class="security" cellspacing="0" width="642" style="table-layout: fixed;">
<tbody>
<tr>
<td width="34"><p class="Intestazionecolonnatabella"><img src="/documents/VersUploadManuals/833/OA.png" alt="test" width="30"></p></td>
<td class="lrt" width="608"><p class="Messaggiosicurezzaintegrato">msg 2<br><br></p></td>
</tr>
<tr>
<td width="34"><p class="Intestazionecolonnatabella"><img src="/documents/VersUploadManuals/834/OAM.png" alt="test" width="30"></p></td>
<td class="lrt" width="608"><p class="Messaggiosicurezzaintegrato">msg 2<br><br></p></td>
</tr>
<tr>
<td width="34"><p class="Intestazionecolonnatabella"><img src="/documents/VersUploadManuals/835/PE.png" alt="test" width="30"></p></td>
<td class="lrt" width="608"><p class="Messaggiosicurezzaintegrato">msg 2<br><br></p></td>
</tr>
</tbody>
</table>

Class "security" and "alert" are connected with the same word table style, the only difference is the column width.

        ".alert": "Grigliatabellachiara",
        ".security": "Grigliatabellachiara",

Thanks!

Posted by admin  · 18-06-2021 - 17:17

Hello,

We have done some tests using your HTML and custom images, and both tables are added correctly and the images are inserted too.

Please note that phpdocx works as a web browser when adding images. If an image doesn't exist (or it can't be readed with PHP or it's corrupted), phpdocx ignores it and the image is not added to the document. Please check that the images you are adding exist and the paths are correct. We see you are adding JPG images in the first HTML and PNG in the second HTML; phpdocx is compatible with both image formats (and also others), but we just wanted to comment it so you can check if the image paths are correct in both cases.

If you send to contact[at]phpdocx the DOCX output you get after running your code (using the HTML that is not adding the images), we'll check it. If you also send the images you are adding we'll test them too.

Regards.

Posted by s.montanarella  · 22-06-2021 - 10:05

There was a issue trying opening file with short file name, so it was our fault, sorry!

Thank you!