Replies: 2   Views: 3493
Docx corrupt when adding png image
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 chokehold  · 12-02-2016 - 20:09


I have a problem with my docx generation. I have a template where i replace some variables and generate a docx document... That works fint..

As soon as i add an image word tells me that the files is corrupt. But letting Word correct the error gives me the document as i expect it to be. 

Im adding image like this...

$docx->addBreak(array('type' => 'page'));
                $options = array(
                'src' => $value['img_path'],
                'imageAlign' => 'center',
                'scaling' => 100,
                'spacingTop' => 10,
                'spacingBottom' => 0,
                'spacingLeft' => 0,
                'spacingRight' => 20,
                'textWrap' => 0,


Im lost here .. ? ..

Posted by admin  · 12-02-2016 - 21:05


Please send the image to contact[at] to do some tests.


Posted by admin  · 15-02-2016 - 08:02

The problem is the file name:
As it has two dots, PHP gets a wrong extension. Please rename to a single extension and it'll work fine.