Intelligently size the dialog

Base dimensions on image width and height, and viewport width and height