gallery: fix for read file 

This PR will fix reading images by using the view object.
This is necessary for reading encrypted files.

cc @schiesbn @icewind1991 @DeepDiver1975 @karlitschek