loadImage function created