Adds sorting of the gallery files due to different orders on different devices
Fixes invert
Merge branch 'master' into firefox