Images embedded in doc generated from php not showing up when opened in mobile(android and ios)

256 views Asked by At

I have used the following code to convert html to doc using php.It works perfectly fine on pc but when accessed from any mobile device then the text part is showing up fine but not the embedded images.It is showing the img src link i.e http://domain/image.jpg but not the images.How can I solve this issue?

<? header("Content-Type: application/vnd.ms-word");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;filename=Report.doc");
?>
1

There are 1 answers

2
Matthew Turland On

From the last example here, try adding images to your document like so

$source = file_get_contents('/path/to/my/images/earth.jpg');
$textrun->addImage($source);