Add batching to attachCompanionFilesToImage (See #12485)
Merge pull request #2867 from joshmoore/rebased/develop/12485-companion-loop

Add batching to attachCompanionFilesToImage (See #12485) (rebased onto develop)