-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Hi, I am new to PHPWord and I am struggling with embedded images. The following code works fine if I output to HTML or ODText, but produces a seemingly blank document when using the Word2007, PDF or RTF writers:
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addImage(
'/vagrant/tmp/test.jpg',
array(
'width' => 600,
'height' => 402,
)
);
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('/vagrant/tmp/'.uniqid().'.docx');
echo 'DONE';
I have also run Sample_13_Images.php, which does the same thing - HTML and ODText output is fine, other formats are not.
The actual filesize is inflated by the size of the image (so it does appear to be embedded) but it does not appear.
I don't see any errors in the Apache log. I am using CentOS 6.4 and PHPWord 0.11.1. PHP-GD and PHP-XML are installed.
Hope I'm not being stupid!