public function guessMimeTypeForContent($content)
    {
        $finfo = new finfo(FILEINFO_MIME);

        // Strip charset and other potential data, keep only the base type
        $parts = explode(' ', $finfo->buffer($content));

        return trim($parts[0], '; ');
    }