Finished code for image loading from getImage()