Updates to the image preloader

Changed to getElementsByTagName so the directive will be removed at the end of the loop.