Forum


Replies: 2   Views: 3628
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

Hey

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,
                
                );
                $docx->addImage($options); 

 

Im lost here .. ? ..

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

Hello,

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

Regards.

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

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