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

Supports loading of word files with images added on OneDrive #2245

Open
pinekta opened this issue Jun 20, 2022 · 1 comment · May be fixed by #2246
Open

Supports loading of word files with images added on OneDrive #2245

pinekta opened this issue Jun 20, 2022 · 1 comment · May be fixed by #2246

Comments

@pinekta
Copy link

pinekta commented Jun 20, 2022

Describe the Bug

Add images by editing Word in OneDrive and download Word files locally
When loaded with PhpOffice\PhpWord\IOFactory::load
Fixed a bug that caused PhpOffice\PhpWord\Exception\InvalidImageException.

If you unzip a normal Word file with zip
/docProps
/word
/_rels
Image files are in the directory
It is saved as /word/media/xxx.png.

However, if it is a file with images added with OneDrive
/docProps
/media
/word
/_rels
It is stored in the media directory of the directory called
In getRels of PhpOffice\PhpWord\Reader\Word2007 Since it is assumed that the image exists in the /word/mediadirectory, The image in the/media` directory could not be read and an error occurred.

Steps to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = PhpOffice\PhpWord\IOFactory::load('/path/to/word_added_image_with_onedrive.docx');

Expected Behavior

Being able to load word files

Current Behavior

PhpOffice\PhpWord\Exception\InvalidImageException occurs

Context

If it is a word file with an image added on OneDrive
Reproduce any PHP version or PHP Word version.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Sep 21, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants