Changed the code that the onProgress event is triggered

Changed the imaged loading from a 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 a src attribute of an image element