Base the maximum thumbnail size on the smaller dimension of the screen size.

The issue was the if you added an image while in landscape, the thumbnail size would be larger than the editor could display if the device was rotated to portrait.

Also fixed inconsistent image size when adding an image that needs to be downloaded over the network. Fixes #1407

Fixes #1407