public function extToMimeType(string $ext_file): string
    {
        if ($ext_file && !preg_match('/^[a-z0-9_\-]+$/ui', $ext_file)) {
            $ext = $this->c::fileExt($ext_file);
        } else {
            $ext = $ext_file;
        }
        switch (($ext = mb_strtolower($ext))) {
            case 'svg':
                $type = 'image/svg+xml; charset=utf-8';
                break;

            case 'png':
                $type = 'image/png';
                break;

            case 'jpg':
                $type = 'image/jpeg';
                break;

            case 'gif':
                $type = 'image/gif';
                break;

            default:
                $type = $ext ? 'image/'.$ext : '';
        }
        return $type;
    }
public function extToMimeType(string $ext_file): string
    {
        if ($ext_file && !preg_match('/^[a-z0-9_\-]+$/ui', $ext_file)) {
            $ext = $this->c::fileExt($ext_file);
        } else {
            $ext = $ext_file;
        }
        switch (($ext = mb_strtolower($ext))) {
            case 'svg':
                $type = 'image/svg+xml; charset=utf-8';
                break;

            case 'png':
                $type = 'image/png';
                break;

            case 'jpg':
                $type = 'image/jpeg';
                break;

            case 'gif':
                $type = 'image/gif';
                break;

            default:
                $type = $ext ? 'image/'.$ext : '';
        }
        return $type;
    }
public function extToMimeType ( string $ ext_file ) : string { if ( $ ext_file && ! preg_match ( '/^[a-z0-9_\-]+$/ui' , $ ext_file ) ) { $ ext = $ this -> c :: fileExt ( $ ext_file ) ; } else { $ ext = $ ext_file ; } switch ( ( $ ext = mb_strtolower ( $ ext ) ) ) { case 'svg' : $ type = 'image/svg+xml; charset=utf-8' ; break ; case 'png' : $ type = 'image/png' ; break ; case 'jpg' : $ type = 'image/jpeg' ; break ; case 'gif' : $ type = 'image/gif' ; break ; default : $ type = $ ext ? 'image/' . $ ext : '' ; } return $ type ; }
Extension to MIME type.

@since 17xxxx Imagick utils.

@param string $ext_file Extension (or file).

@return string Extension MIME type.
Extension to MIME type .