src/Support/Content/MimeTypeHelper.php
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], '; ');
    }
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], '; ');
    }
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 ] , '; ' ) ; }
Returns the mime type for given raw file content.

@param string $content
@return string
Returns the mime type for given raw file content .