use relative paths to create images from a file. 

This way it also works if no user is logged in (e.g. public gallery share)

Fix for #5994