<table class='detail-view'>
<tr>
<th colspan='3' class='header'>
Basic Information</th>
</tr>
<tr class='odd' >
<th >
Id No
</th>
<td >
2011-0001
</td>
<td rowspan=7" >
<img style="width: 200px; height: 200px;" src="/albuja/assets/339833f3/2011-0001.jpg" alt="2011-0001.jpg" /> </td>
</tr>
<tr class='even'>
<th >
Name
</th>
.............. and so on
If I just render it to the screen, it displays the image. When allowing the user to export it file to MS Word, the image is not included in the exported file
Thanks gustavo, the picture is now showing when exported to msword
The only problem left is when being exported to PDF. I use DOMPDF. Do you have any idea how to fix this? Or is there a better HTML->PDF exporter than Dompdf?
Oh yes, I just got overwhelmed I forgot to say how
Dompdf does not see the image if I give it a URL, and with some experiments, it worked using the absolute path of image. But that will make my export to WORD not work again, so I just added a parameter to check whether I am printing an HTML,word,or PDF.
Here’s the part of my code which I changed
//fullpath is needed in order for export to PDF to work
!$fullPath ? $div .= CHtml::image('http://' . $_SERVER['HTTP_HOST'] . '/' . Yii::app()->getAssetManager()->publish($img, true, 0, true), $alt . '.jpg', $options) :
$div .= CHtml::image($_SERVER['DOCUMENT_ROOT'] . '/' . Yii::app()->getAssetManager()->publish($img, true, 0, true), $alt . '.jpg', $options);
where $fullPath is my parameter to check if I needed the absolute path, which means I am printing PDF.