Get the mime type.

@param string $extension

@return string
339474
public function getMimeType($extension)
    {
        if (isset($this->mimeTypes['.'.strtolower($extension)])) {
            return $this->mimeTypes['.'.strtolower($extension)];
        }

        return 'text/plain';
    }
1097169
public static function getMimeByExtension(string $extension): string
    {
        $extension = strtolower($extension);

        if (!isset(static::$types[$extension])) {
            throw new HttpException("Unknown file extension={$extension}");
        }

        return static::$types[$extension];
    }
1020029
public function MapExtensionToMimeType($mime_type, $extension)
    {
        if (!isset($this->mime_type_to_extensions[$mime_type])) {
            $this->mime_type_to_extensions[$mime_type] = array($extension);
        } else {
            $this->mime_type_to_extensions[$mime_type][] = $extension;
        }

        return true;
    }
982572
protected function getType($file)
    {
        $extension = $file->ext();
        if (isset($this->typeMap[$extension])) {
            return $this->typeMap[$extension];
        }

        return $file->mime() ?: 'application/octet-stream';
    }
573392
public static function get_type_from_mime_type($mimeType) {
        $types = [
            'image/jpeg' => 'jpg',
            'image/png' => 'png',
            'image/gif' => 'gif',
        ];
        if (isset($types[$mimeType])) return $types[$mimeType];
        throw new ImageException(sprintf('Unsupported MIME type: %s', $mimeType), ImageException::UNSUPPORTED_MIME_TYPE);
    }
889504
public function getFormatForFileExtension($extension)
    {
        $format = $this->getConfiguredFormat();
        if ($format === static::FORMAT_AUTO) {
            $format = $this->getAutomaticFormatForFileExtension((string) $extension);
        }

        return $format;
    }
516058
function get_extension($type)
    {
        $type = strtolower($type);
        foreach ($this->mime_types as $ext => $m_type) {
            if ($m_type == $type) return $ext;
        }
        return false;
    }
863874
public function getMimeType($extension)
    {
        /**
         * check and remove (*.)ext so we only got the extension
         * when wrong define for example *.jpg becomes jpg
         */
        if (false != preg_match("#^.*\.(?P<EXTENSION>[a-z0-9]{2,4})$#i", $extension, $match)) {
            $extension = $match['EXTENSION'];
        }

        $extension  = strtolower($extension);

        if (is_null($this->mimeTypes)) {
            $file = __DIR__.'/../Resources/config/mime.yml';
            if (is_file($file)) {
                $this->mimeTypes = Yaml::parse(file_get_contents($file));
            } else {
                throw new \InvalidArgumentException('Mime file not found, perhaps you need to create it first? (zicht:filemanager:create:mime)');
            }
        }

        if (array_key_exists($extension, $this->mimeTypes)) {
            return $this->mimeTypes[$extension];
        } else {
            throw new \InvalidArgumentException(sprintf('Could not determine mime type on: %s', $extension));
        }
    }
1136181
public function toMimeType($extension)
    {
        $extension = strtolower($extension);

        if (array_key_exists($extension, $this->dict)) {
            return $this->dict[$extension];
        }
    }
366467
public function getMimeType()
	{
		$finfo = finfo_open(FILEINFO_MIME_TYPE);
		$mime = finfo_file($finfo, $this->path);
		finfo_close($finfo);

		return $mime;
	}
1314925
private static function getMimeTypeOfFile($path)
    {
        $fileInfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime     = finfo_file($fileInfo, $path);
        finfo_close($fileInfo);

        return $mime;
    }
75084
public function getExtensionFromMimeType($mimeType) {
        return isset($this->mimeTypeToExtension[$mimeType]) ? $this->mimeTypeToExtension[$mimeType] : null;
    }
552113
public function getMimeTypeFromFile($file)
	{
		$extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
		if (array_key_exists($extension, $this->_alt_mime_types)) {
			return $this->_alt_mime_types[$extension];
		} else {
			return (new \Finfo(FILEINFO_MIME_TYPE))->file($file);
		}
	}
1014310
protected static function getTypeFileExtList($file) {

		$info = pathinfo(strtolower($file));

		if(isset(self::$extensionToMime[$info['extension']])) {
			return self::$extensionToMime[$info['extension']];
		}
		else {
			return self::DEFAULT_MIME_TYPE;
		}

	}
213111
public static function detectByFileExtension($extension)
	{
		static $extensionToMimeTypeMap;

		if (!$extensionToMimeTypeMap)
		{
			$extensionToMimeTypeMap = static::getExtensionToMimeTypeMap();
		}

		if (isset($extensionToMimeTypeMap[$extension]))
		{
			return $extensionToMimeTypeMap[$extension];
		}
	}
1128
public static function getMimetype($name)
    {
        $parts = explode('.', $name);
        if (count($parts) > 1) {
            $ext = strtolower(end($parts));
            if (isset(self::$mime_types[$ext])) {
                return self::$mime_types[$ext];
            }
        }

        return null;
    }
925502
public function resolveFilename($extension = null)
    {
        if ($extension === null) {
            $extension = $this->extension;
        }
        return $this->name . '-' . $this->id . '.' . $extension;
    }