Improved handling of image upload.
Merge branch 'test' into dev