Replies: 1   Views: 1148
Broken shape->imagefill in multimerge
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 greatjakes  · 22-02-2021 - 23:03

Version/License: 10.0 Premium

For the purpose of troubleshooting, I've reproduced the issue using the simplest possible code and documents and confirmed this issue appears to be a bug in phpdocx.


I'm trying to use MultiMerge to merge two fairly complex documents. When $docs (2nd document) contains Shape-formatted images where the image reference doesn't also exist in the $first document, the images in $docs are broken.

Here's what I mean by "Shape-formatted images":

  • Insert > Shape > Oval > [Draw the shape into the 2nd document]
  • Oval > Format Shape > Fill > Picture fill > [Insert a picture into the shape]

What happens is the final/merged document contains the elements, but the images are broken. The images show the "X" icon and error "The picture can't be displayed."


If I also place those images in the $first document, the images display as expected in the second document/page. However this isn't a viable solution for my use-case.


This problem doesn't occur if I use normal picture elements. It only becomes a problem if I have a Shape filled with a picture. It's also a problem when using SVG images.


Posted by admin  · 23-02-2021 - 06:29


UPDATE: phpdocx 12 added support to images embedded in shapes when using merge methods.

Images embedded in shapes aren't supported in the current stable release of the merging class, only normal images are supported. Merging shapes is supported but not when they have an embedded image.

On the API documentation page of the method ( you can read the supported contents when merging the documents with mergeDocx in the current stable version. As you can read, all contents without internal/external dependencies are supported (paragraphs, tables, run-of-text, bookmarks, text boxes, fields...) and also the following contents with internal dependencies: styles, images, charts, links, cross-references, lists, altChunks, footnotes, endnotes, comments, headers, footers and sections; shapes aren't listed as supported contents when merging with dependencies, although they are supported if they don't have an internal/external dependency such as an image.

The testing branch includes support for embedded images in shapes that will be included in the next release of phpdocx (there's no release date). Advanced and Premium licenses with LUS active ( can get features available in the testing branch but not in the stable version; if your license includes an active LUS please send an email to contact[at] with the following information: you are using the classic or namespaces package, and the dev team will send you the updated class.