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.
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 causedPhpOffice\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
ofPhpOffice\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
Expected Behavior
Being able to load word files
Current Behavior
PhpOffice\PhpWord\Exception\InvalidImageException
occursContext
If it is a word file with an image added on OneDrive Reproduce any PHP version or PHP Word version.