Handle invalid URL error in image upload

The image url validation code throws an exception on invalid URLs which
we were not catching. This now catches it and displays an error message.

Fixes #558