replaces html image references for images to be embedded