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 #2246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pinekta
Copy link

@pinekta pinekta commented Jun 20, 2022

Description

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.

for that reason,
If a directory has a "/" at the beginning, it has been modified to refer to that directory.

Fixes #2245

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported

An error was reported where it had nothing to do with the fix.

Checked all files in 0.680 seconds, 12.000 MB memory used
> phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n
> phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
/path/to/PHPWord/src/PhpWord/Element/TOC.php:27  CamelCasePropertyName  The property $TOCStyle is not named in camelCase.
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes
    There was no description because it was a minor bug fix.

@github-actions
Copy link

This PR 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 complete the PR by adding tests and making sure that the CI is green.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Sep 21, 2022
@PowerKiKi PowerKiKi changed the base branch from develop to master November 16, 2022 21:08
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
@Progi1984 Progi1984 force-pushed the master branch 3 times, most recently from 2d9f999 to e458249 Compare August 30, 2023 11:56
@kristianbinau
Copy link

What's the status for this PR?
This fixes an issue we're having, is there anything we can do to make it easier for you to merge? : )

@Progi1984 Progi1984 added this to the 2.0.0 milestone Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Supports loading of word files with images added on OneDrive
3 participants