JSON plugin: Correctly resolve and clean the image paths

Since the last change, only the path used to load the image was
resolved, while the path remembered was the unresolved one and was also
not cleaned of "../" sequences. This can lead to problems later on (for
example when saving the map at a different location).