If {@link #check()} was successful, returns a String with the MIME type of the format.

@return MIME type, e.g. <code>image/jpeg</code>
331549
public String getMimeType() {
        if (format >= 0 && format < MIME_TYPE_STRINGS.length) {
            if (format == FORMAT_JPEG && progressive) {
                return "image/pjpeg";
            }
            return MIME_TYPE_STRINGS[format];
        }
        return null;
    }
1079126
public static boolean isImage( File file ){
		try {
			String mimeType = Files.probeContentType(file.toPath());
			if( mimeType == null ) {
				// In some OS there is a bug where it always returns null/
				String extension = FilenameUtils.getExtension(file.getName()).toLowerCase();
				String[] suffixes = ImageIO.getReaderFileSuffixes();
				for( String s : suffixes ) {
					if( s.equals(extension)) {
						return true;
					}
				}
			} else {
				return mimeType.startsWith("image");
			}
		} catch (IOException ignore) {}
		return false;
	}
294982
public static String getMimeType(String url) {
        String extension = getExtension(url);
        if (!MimeTypeMap.getSingleton().hasExtension(extension)) return "";

        String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
        return TextUtils.isEmpty(mimeType) ? "" : mimeType;
    }
361012
protected function checkType()
    {
        if (is_scalar($this->format)) {
            return array_key_exists($this->format, $this->patterns);
        } elseif (is_array($this->format)) {
            $pattern = [];
            foreach ($this->format as $f) {
                if (!array_key_exists($f, $this->patterns)) {
                    return false;
                }
                $pattern[] = substr($this->patterns[$f], 2, strlen($this->patterns[$f]) - 4);
            }
            $this->format = 'custom';
            $this->patterns[$this->format] = '/^(' . implode('|', $pattern) . ')$/';

            return true;
        }

        return false;
    }
523453
private static Bitmap.CompressFormat getOutputFormat(@Nullable final ImageFormat format) {
    if (format == null) {
      return Bitmap.CompressFormat.JPEG;
    }

    if (format == DefaultImageFormats.JPEG) {
      return Bitmap.CompressFormat.JPEG;
    } else if (format == DefaultImageFormats.PNG) {
      return Bitmap.CompressFormat.PNG;
    } else {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
          && DefaultImageFormats.isStaticWebpFormat(format)) {
        return Bitmap.CompressFormat.WEBP;
      }

      return Bitmap.CompressFormat.JPEG;
    }
  }
473357
public String getTextType() {
        if (textType == null) {
            String mimeType = getMimeType();
            String extension = getNameExtension();
            textType = getTextType(mimeType, extension);
        }
        return textType;
    }
1200926
public MediaType getContentType() {
		String value = getFirst(CONTENT_TYPE);
		return (StringUtils.hasLength(value) ? MediaType.parseMediaType(value) : null);
	}
569553
public ResourceFormatParser getParserForMIMEType(final String mimeType) throws UnsupportedFormatException {
        //clean up encoding
        final String cleanMime;
        if (null != mimeType && mimeType.indexOf(";") > 0) {
            cleanMime = mimeType.substring(0, mimeType.indexOf(";"));
        } else {
            cleanMime = mimeType;
        }
        if (!validMimeType(cleanMime)) {
            throw new IllegalArgumentException("Invalid MIME type: " + mimeType);
        }
        for (final ResourceFormatParser resourceFormatParser : listParsers()) {
            if(null!= resourceFormatParser.getMIMETypes()){
                if (resourceFormatParser.getMIMETypes().contains(cleanMime)) {
                    return resourceFormatParser;
                } else {
                    for (final String s : resourceFormatParser.getMIMETypes()) {
                        if (validMimeType(s) && s.startsWith("*/")) {
                            String t1 = s.substring(2);
                            String t2 = cleanMime.substring(cleanMime.indexOf("/") + 1);
                            if (t1.equals(t2)) {
                                return resourceFormatParser;
                            }
                        }
                    }
                }
            }
        }
        throw new UnsupportedFormatException("No provider available to parse MIME type: " + mimeType);
    }
391622
public static MimeType getMimeType(String value) {
        if (StringUtils.isNotBlank(value)) {
            try {
                return getMimeTypes().forName(value);
            } catch (MimeTypeException e) {
                MediaType mediaType = getMediaType(null, value);
                if (mediaType != null) {
                    try {
                        return getMimeTypes().forName(mediaType.toString());
                    } catch (MimeTypeException e1) {
                        // detection not successful
                    }
                }
            }
        }
        return null;
    }
1237309
public PhotoType getType() {
        if (this.source != null) { return PhotoType.SOURCE; }
        if (this.file   != null) { return PhotoType.FILE;   }
        return null;
    }
1243891
function getMimeType (media) {
  return new Promise((resolve, reject) => {
    if (isFile(media)) {
      typechecker.detectFile(media, (err, result) => {
        err && reject(err)
        resolve(result)
      })
    } else if (isBuffer(media)) {
      typechecker.detect(media, (err, result) => {
        err && reject(err)
        resolve(result)
      })
    } else if (isBase64(media)) {
      return getMimeType(toBuffer(media))
    } else if (isURL(media)) {
      return getMimeType(toBuffer(media))
    } else {
      reject('media is not a file')
    }
  })
}
718115
public function check_mime_detection()
    {
        $errors = array();
        $files  = array(
            'program/resources/tinymce/video.png' => 'image/png',
            'program/resources/blank.tiff'        => 'image/tiff',
            'program/resources/blocked.gif'       => 'image/gif',
        );

        foreach ($files as $path => $expected) {
            $mimetype = rcube_mime::file_content_type(INSTALL_PATH . $path, basename($path));
            if ($mimetype != $expected) {
                $errors[] = array($path, $mimetype, $expected);
            }
        }

        return $errors;
    }
31848
public function getType()
    {
        $mimeType = preg_replace('#^([^/]+)/.*$#', '$1', $this->getMimeType());

        if ($mimeType == 'video') {
            return Media::VIDEO;
        }

        if ($mimeType == 'audio') {
            return Media::AUDIO;
        }

        if ($mimeType == 'image') {
            return Media::IMAGE;
        }

        $extension = $this->getExtension();

        if (in_array($extension, $this->imagesExtensions())) {
            return Media::IMAGE;
        }

        if (in_array($extension, $this->audiosExtensions())) {
            return Media::AUDIO;
        }

        if (in_array($extension, $this->videosExtensions())) {
            return Media::VIDEO;
        }

        return Media::OTHER;
    }
129873
protected <T extends ImageBase> ImageType<T> getImageType( int which ) {
		synchronized ( inputStreams ) {
			return inputStreams.get(which).imageType;
		}
	}
492628
public MimeType getMimeType() {
		if (format >= 0 && format < MIME_TYPE_STRINGS.length) {
			if (format == FORMAT_JPEG && progressive)
			{
				return new MimeType("image/pjpeg");
			}
			return new MimeType(MIME_TYPE_STRINGS[format]);
		} else {
			return null;
		}
	}
720100
public String getMimeType()
   {
      if (mediaType == null || untrustedAgent)
      {
         return mimeTypeResolver.getMimeType(fileName);
      }

      return mediaType.getType() + "/" + mediaType.getSubtype();
   }
525738
@Override
	public CheckResult check() {
		try {
			post(new byte[] { '[', ']' });
			return CheckResult.OK;
		}
		catch (Exception e) {
			return CheckResult.failed(e);
		}
	}