Hello,
embedHTML and replaceVariableByHTML methods download the images to be added (the downloadImages option is true as default, if this option is set as false then the images are not downloaded but added as external images) using the file_get_contents function from PHP. If the error is not always the same (the images not being added aren't the same for each execution of the script), maybe some image or the script are returning a timeout when downloading the files? Or the external server is retricting access to download them?
On https://www.phpdocx.com/documentation/cookbook/insert-images-html you can find some documentation about adding images from HTML.
We recommend checking the logs in your server and the remote server to check if the images are being readed correctly.
If you send the most simple script with a HTML sample you are transforming to contact[at]phpdocx.com we'll do some tests. If you also send a sample DOCX output with missing images (please as small as possible), we'll check it too.
Regards.