Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not read images on Word file #1159

Open
rogerarruda opened this issue Oct 18, 2017 · 19 comments
Open

Not read images on Word file #1159

rogerarruda opened this issue Oct 18, 2017 · 19 comments

Comments

@rogerarruda
Copy link

I'm trying to open a Word document already with previously added images, when showing or saving again using PHPWord the image does not appear.
I'm trying to read the Word file and save it to PDF with the same content and formatting, but the images disappear when saving or even trying to view the HTML.
How to proceed? Is there a way to read the saved Word file's images?

@FBnil
Copy link

FBnil commented Oct 30, 2017

IIRC the PDF exporter uses the HTML methods to generate the document, and the quality is not yet Production-ready. I saw a few patches, but they are not yet merged into the product. If you have time to donate, maybe you can help out adding this functionality, or if you need it working fast, then save to docx and use another product: UNO/oowriter to do the conversion.

@cubicleWar
Copy link

cubicleWar commented Jan 3, 2018

I dont think this issue is unique for exporting to PDF. I am encountering this issue when I open an exisiting docx file containing images with IOFactory::load(). When I save as a docx again all the images and most of the formatting is missing.

Also from #882 it looks like a IOFactory parsing issue.

@troosan
Copy link
Contributor

troosan commented Jan 3, 2018

@cubicleWar the template processor is not using the IOFactory, just doing seach & replace in the xml document, so images should not be lost. The issue must be something else

@cubicleWar
Copy link

@troosan sorry, you are right I meant I encounter the issue loading an exisiting document with IOFactory. The template Processor maintains all images and formatting correctly.

@jacklove2run
Copy link

Dose IOFactory lost images issue solved now? I have tried the lastest developer version but it didn't work.

@troosan
Copy link
Contributor

troosan commented Mar 29, 2018

PHPWord currently does not parse images from documents created with Word 2011+
There is a PR for that which I did not merge yet.

@IamAbhiKaushik
Copy link

Hii, What code should I use to read an Image I have in the Word file. can someone provide me the exact command for reading an image?

@efpapado
Copy link
Contributor

PHPWord currently does not parse images from documents created with Word 2011+
There is a PR for that which I did not merge yet.

Which PR is that?

@troosan
Copy link
Contributor

troosan commented Jan 30, 2019

@efpapado is is #1324 but it has been merged to master already.
It was part of version 0.15

@adam-godfrey
Copy link

I have updated to version 0.16 but when I try saving the file, no images are displayed

@dhirajpatra
Copy link

Not able to read images of any types.

@danmatthews
Copy link

Hey there.

I'm currently looking at PHPWord as a solution for a client so he can do some replacements through 200+ documents.

He has images and diagrams in these documents that seem to be getting stripped by the library, is there any current information on what the state of image reading is - or is it the case that i might be "doing it wrong".

Thanks.

@garbast
Copy link

garbast commented Aug 4, 2019

The problem that image are missing after a docx file was loaded and saved as docx file again is still present in 0.16.0 Are there any near time plans to fix this? How much time would it take? And would the possibility to get an invoice speed up the process?

@garbast
Copy link

garbast commented Aug 4, 2019

To spice the hole topic a bit. Non of the files /word/media/* are considered to be read while loading a docx file with \PhpOffice\PhpWord\Reader\Word2007

While \PhpOffice\PhpWord\TemplateProcessor::zip() mentions the replacement or reading of images in the comment, \PhpOffice\PhpWord\TemplateProcessor::addImageToRelations() uses the path in $typeTpl and \PhpOffice\PhpWord\Writer\Word2007::__construct() adds them to the $this->mediaPaths, the reader skips the media handling completely.

@navotera
Copy link

navotera commented May 9, 2020

Hi
Any information update about this issue?
Since I think this is very important features for handling document.

Thank

@ernst77
Copy link

ernst77 commented May 9, 2020

There is few PR’s (#1794 and #1799 ) if you need it you can use them instead of main repository. So far it seams nobody is taking time to merge the PR’s probably this repo is dead :)

@navotera
Copy link

Hi @ErnestStaug

Thank for your reply. I need to try this PR :)

@irisda
Copy link

irisda commented Apr 22, 2021

@navotera did you solve your problem?

@navotera
Copy link

@irisda I am sorry, we are using the Libre native package for processing the word file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests