#1159 Catch a few more OutOfMemoryErrors in createThumbnailFromUri()

Fixes #1159.