Implementation of the function to load an image from internal storage,
correction of some bugs.