Fix viewing shared subfolders in the gallery app.

Save the id of shared folders in the image path so we can always recreate the original path

Fixes #1434 

cc @butonic @DeepDiver1975 @Wikinaut @karlitschek