Store a relative url to the image in the database, instead of the absolute url

This should fix display of images on remote storage groups but not yet
generation of thumbnails from remote storage. That will be addressed
by further commits.