Forum


Replies: 4   Views: 4184
Header image not working?
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 seb  · 11-12-2012 - 11:50

Hi,

I'm about to create a very complex document, and I'm starting by testing some of the features.

At the moment, I can't seem to get an image to appear in the header.

I've un-zipped the document created by phpdocx and the image is in there, so thats fine, but it just doesn't appear in the document when loaded in Word 2010.

Here is by debug output - all looks ok:

2012-12-11 11:36:56,058 INFO - Create a temp file to use as initial ZIP file. DOCX is a ZIP file.
2012-12-11 11:36:56,058 INFO - The language has been set.
2012-12-11 11:36:56,058 INFO - Add header to header document.
2012-12-11 11:36:56,058 INFO - Add image to header document.
2012-12-11 11:36:56,058 DEBUG - New ID 78886754 . Image header.
2012-12-11 11:36:56,058 INFO - Add image header word/media/image78886754.jpg.xml to DOCX.
2012-12-11 11:36:56,058 INFO - Set DOCX name to: dynamic_docs/hello_world.
2012-12-11 11:36:56,058 DEBUG - DOCX is a new file, not a template.
2012-12-11 11:36:56,058 DEBUG - There is a new header, add it.
2012-12-11 11:36:56,058 DEBUG - New ID 78886755 . Header.
2012-12-11 11:36:56,058 INFO - Add word/header.xml content to DOCX file.
2012-12-11 11:36:56,058 DEBUG - There is a header rels, add it.
2012-12-11 11:36:56,058 INFO - Add word/_rels/header.xml.rels content to DOCX file.
2012-12-11 11:36:56,058 DEBUG - Remove existing template tags.
2012-12-11 11:36:56,058 INFO - Add word/document.xml content to DOCX file.
2012-12-11 11:36:56,058 INFO - Close the zip.
2012-12-11 11:36:56,058 INFO - Copy DOCX file using a new name.

And if I look in [b]/my_doc/word/media/[/b] i do find [b]image78886754.jpg[/b].

Could I please get some help on this?

Thanks,
Seb

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please run the included example to check if the image is in header and comment your test.

Regards.

Posted by seb  · 11-04-2013 - 12:13

Hi,

Thanks for the reply. OK, so I just ran the example on my server:

[b]/phpdocx_pro/examples/intermediate/HeaderAndFooter.php[/b]

which creates this file:

[b]example_header_and_footer.docx[/b]

The document generates, but there is no image in the header. If I unzip the docx, the image is included in the folder /word/media/, it just doesn't appear in the document.

This is the debug output when running this example:

2012-12-12 10:18:55,368 INFO - Create a temp file to use as initial ZIP file. DOCX is a ZIP file.
2012-12-12 10:18:55,368 INFO - The language has been set.
2012-12-12 10:18:55,368 INFO - Add header to header document.
2012-12-12 10:18:55,368 INFO - Add image to header document.
2012-12-12 10:18:55,368 DEBUG - New ID 17160979 . Image header.
2012-12-12 10:18:55,368 INFO - Add image header word/media/image17160979.png.xml to DOCX.
2012-12-12 10:18:55,368 INFO - Add header to header document.
2012-12-12 10:18:55,368 INFO - Add footer to footer document.
2012-12-12 10:18:55,368 INFO - Add footer to footer document.
2012-12-12 10:18:55,368 INFO - Set DOCX name to: ../docx/example_header_and_footer.
2012-12-12 10:18:55,368 DEBUG - DOCX is a new file, not a template.
2012-12-12 10:18:55,368 DEBUG - There is a new footer, add it.
2012-12-12 10:18:55,368 DEBUG - New ID 17160980 . Footer.
2012-12-12 10:18:55,368 INFO - Add word/footer.xml content to DOCX file.
2012-12-12 10:18:55,368 DEBUG - There is a new header, add it.
2012-12-12 10:18:55,368 DEBUG - New ID 17160981 . Header.
2012-12-12 10:18:55,368 INFO - Add word/header.xml content to DOCX file.
2012-12-12 10:18:55,368 DEBUG - There is a header rels, add it.
2012-12-12 10:18:55,368 INFO - Add word/_rels/header.xml.rels content to DOCX file.
2012-12-12 10:18:55,368 DEBUG - Remove existing template tags.
2012-12-12 10:18:55,368 INFO - Add word/document.xml content to DOCX file.
2012-12-12 10:18:55,368 INFO - Close the zip.
2012-12-12 10:18:55,368 INFO - Copy DOCX file using a new name.

Please let me know if you need any further information - I'd really like to get this working as PHPDOCX looks potentially like a really useful library.

Thanks,
Seb

Posted by admin  · 11-04-2013 - 12:13

Hello,

It's really strange, I have done more tests and I see everything working fine. Please paste your server specs (distribution, PHP version, 32bits or 64bits) and which program are you using to open the DOCX: Word 2003, Word 2007, Word 2010, Word for Mac, OpenOffice, LibreOffice...; please paste program and version.

Regards.