Gallery: fix displaying of wide images

Fixes #563