Correctly detect image size on all browsers.

Closes #268.