Gallery: better selecting images to show