Keep imageType and mimeType properties in sync. (+1 squashed commit)

See https://github.com/owncloud/core/pull/10313 for details.
Prevents image type and mime type from getting out of sync resulting in png data being sent to browser with mime type != image/png. Fixes IE image preview (including ldap avatars) issue for non png images.