Magic mimetype detection and previews for images