Changed the code so that the onProgress event is triggered

Changed the imaged loading from an simple image element to a XMLHttpRequest that requests the content of the image and converts it to an base64 string that can be put in an src attribute of an image element