Prevents image type and mime type from getting out of sync.