Auto detect mime type whith libmagic and adapt tags