Hello,
If the script returns:
Call to a member function addImage() on null
then $rooms_image in $rooms_image->addImage($image_options); is null, not a CreateDocx/CreateDocxFromTemplate instance. And also, as we can check in the output sent, the error appears in the script you are running:
Call to a member function addImage() on null
File BrochureHelpers.php
If an exception or error is returned by phpdocx, then a phpdocx class appears, not an external script (BrochureHelpers.php)
.
Maybe your code has a conditional that generates a correct CreateDocx object based on the image (or other condition) and in some cases, the object is not being generated correctly?
phpdocx doesn't throw a null error if an image can't be added, it returns an image error exception.
We recommend you to run the included samples and test addImage standalone with the same images: https://www.phpdocx.com/api-documentation/word-content/insert-image-Word-document-with-PHP, so you can find the source of the problem.
Regards.