Add loading logic for background images

this patch adds logic for loading for background images.