I want to create report in doc file this will include images and table. I wrote a following code
<?php
@header("Cache-Control: ");// leave blank to avoid IE errors
@header("Pragma: ");// leave blank to avoid IE errors
@header('Content-Description: File Transfer');
@header("Content-type: application/vnd.ms-word");
@header("Content-Disposition: attachment; filename=report.doc");
?>
<img src="http://l1.yimg.com/dh/ap/default/130613/fruit-chaat.jpg" border="0" style="border:none">
<br>
<table style="border:2;background-color:red;">
<?php
$arr = array();
$arr = array(1,2,3,4,5,);
foreach($arr as $row=>$value){ ?>
<tr><td>First <?php echo $value; ?></td>
</tr>
<?php } ?>
</table>
But It write image from a location if that location is not reachable that image will not display in document file. I used to embed image but this embeds code instead of image. Please suggest some solutions. Is there any other way to doIt. I know about Com object but it works only on window. I am doing development on linux server.
<img src="data:image/jpeg;base64,...">to embed the actualy image in the html file rather than simply linking to itsrc="data:image/jpeg;base64method, you need to actually include the hex data that represents the bytestream of the image file in the image tag itself, as represented by the ... in my comment. If your using a normalimgtag, then you need the full url for the image including the http:// and the full hostname