Returns the "data:" URL

@param mimeType If null, defaults to DataURLType.PNG
@return String
355642
public String toDataURL(final boolean filtered)
    {
        if (false == isLoaded())
        {
            return null;
        }
        if ((m_fastout) || (false == filtered))
        {
            final ScratchPad temp = new ScratchPad(m_jsimg.getWidth(), m_jsimg.getHeight());

            temp.getContext().drawImage(m_jsimg, 0, 0);

            return temp.toDataURL();
        }
        else
        {
            return m_filterImage.toDataURL();
        }
    }
1101000
private static MimeType getParentMimeType(Resource resource) {
        MimeType result = null;
        if (resource != null && (resource = resource.getParent()) != null) {
            ResourceHandle handle = ResourceHandle.use(resource);
            result = getMimeType(handle.getProperty(ResourceUtil.PROP_MIME_TYPE, ""));
            if (result == null) {
                String filename = getResourceName(resource);
                result = getMimeType(filename);
            }
        }
        return result;
    }
904835
def mime(self):
        '''
        
        '''
        return self.metadata['ContentType'] if 'ContentType' in self.metadata else BaseEngine.get_mimetype(self.buffer)
407621
public function getMimeType(): ?string
	{
		$info = finfo_open(FILEINFO_MIME_TYPE);

		$mime = finfo_file($info, $this->getPathname());

		finfo_close($info);

		return $mime ?: null;
	}
414913
protected String getContentType(Resource resource, @SuppressWarnings("unused") SlingHttpServletRequest request) {
    String mimeType = JcrBinary.getMimeType(resource);
    if (StringUtils.isEmpty(mimeType)) {
      mimeType = ContentType.OCTET_STREAM;
    }
    return mimeType;
  }
991791
private function _getUrl($type = 'base', $id = 'null') {
		$modelClass = $this->modelClass;
		$collection = $modelClass::getResourceName();

		switch($type) {
			case 'api':
				return $this->_trailingSlash($modelClass::getApiUrl());
				break;
			case 'collection':
				return $this->_trailingSlash($collection, false);
				break;
			case 'element':
				return $this->_trailingSlash($collection) . $this->_trailingSlash($id, false);
				break;
		}

		return '';
	}
763818
private static MimeType getContentMimeType(Resource resource) {
        MimeType result = null;
        if (resource != null && (resource = resource.getChild(ResourceUtil.CONTENT_NODE)) != null) {
            ResourceHandle handle = ResourceHandle.use(resource);
            result = getMimeType(handle.getProperty(ResourceUtil.PROP_MIME_TYPE, ""));
        }
        return result;
    }
308268
public String getUrl(String mockupType) {
        return mockupType == null ? null : mockupTypes.getProperty(mockupType);
    }
239363
private function buildImgixParams($params, $mimetype = '') {
		$format = null;
		if(!isset($params['fm'])) {
			if(($mimetype == 'image/gif') && $this->enableGifs) {
				$format = 'gif';
			} else if(($mimetype == 'image/png') && !$this->autoFormat) {
				$format = 'png';
			} else if(!$this->autoFormat) {
				$format = 'pjpg';
			}
		} else {
			$format = $params['fm'];
		}

		unset($params['fm']);

		$auto = [];
		if(isset($params['auto'])) {
			$auto = explode(',', $params['auto']);
			unset($params['auto']);
		}

		if (isset($params['flip']) && (strpos($params['flip'], ',') > 0)) {
		    $params['flip'] = 'hv';
        }

		if(!$format) {
			if($this->autoCompress && $this->autoFormat) {
				$auto[] = 'compress';
				$auto[] = 'format';
			} else if($this->autoCompress) {
				$auto[] = 'compress';
			} else if($this->autoFormat) {
				$auto[] = 'format';
			}
		} else if($format) {
			$params['fm'] = $format;
			if($this->autoCompress) {
				$auto[] = 'compress';
			}
		} else {
			$params['fm'] = 'pjpg';
			if($this->autoCompress) {
				$auto[] = 'compress';
			}
		}

		if(count($auto) > 0) {
			$params['auto'] = implode(",", $auto);
		}

		unset($params['enhance']);
		unset($params['redeye']);

		if($this->imageQuality) {
			$params['q'] = $this->imageQuality;
		}

		foreach($this->paramPropsByType['media-chooser'] as $key => $info) {
			if(isset($params[$key]) && !empty($params[$key])) {
				$media_id = $params[$key];
				unset($params[$key]);
				$markMeta = wp_get_attachment_metadata($media_id);
				if (isset($markMeta['s3'])) {
					$params[$info['imgix-param']] = '/'.$markMeta['s3']['key'];
                } else {
					$params[$info['imgix-param']] = '/'.$markMeta['file'];
                }
			} else {
				unset($params[$key]);
				if(isset($info['dependents'])) {
					foreach($info['dependents'] as $depKey) {
						unset($params[$depKey]);
					}
				}
			}
		}

		if(isset($params['border-width']) && isset($params['border-color'])) {
			$params['border'] = $params['border-width'].','.str_replace('#', '', $params['border-color']);
		}

		unset($params['border-width']);
		unset($params['border-color']);

		if(isset($params['padding-width'])) {
			$params['pad'] = $params['padding-width'];

			if(isset($params['padding-color'])) {
				$params['bg'] = $params['padding-color'];
			}
		}

		unset($params['padding-width']);
		unset($params['padding-color']);

		return $params;
	}
742679
public static function getByMimeType(?string $mimeType): int
    {
        switch (explode('/', (string) $mimeType)[0] ?? null) {
            case 'image':
                return static::IMAGE;
            case 'audio':
                return static::AUDIO;
            case 'video':
                return static::VIDEO;
            default:
                return static::FILE;
        }
    }
1078039
public function getFormatFromMimeType($mimeType, $fallback = '')
    {
        $mimeType = trim(strtolower((string) $mimeType));
        switch ($mimeType) {
            case 'image/png':
                $result = static::FORMAT_PNG;
                break;
            case 'image/jpeg':
                $result = static::FORMAT_JPEG;
                break;
            case 'image/gif':
                $result = static::FORMAT_GIF;
                break;
            case 'image/vnd.wap.wbmp':
                $result = static::FORMAT_WBMP;
                break;
            case 'image/xbm':
            case 'image/x-xbm':
            case 'image/x-xbitmap':
                $result = static::FORMAT_XBM;
                break;
            default:
                $result = $fallback;
                break;
        }

        return $result;
    }
994462
static public function getThumbFilename($filename, $mimeType, $size)
    {
        if (substr($mimeType, 0, 5) == 'image')
        {
            $pos = mb_strrpos($filename, '.');
            if ($pos === FALSE)
            {
                return $filename . '_' . $size['width'] . 'x' . $size['height'];
            }
            else
            {
                return mb_substr($filename, 0, $pos) . '_' . $size['width'] . 'x' . $size['height'] . mb_substr($filename, $pos);
            }
        }
        else if ($mimeType == 'application/pdf')
        {
            return $GLOBALS['kernel']->getContainer()->get('templating.helper.assets')->getUrl('bundles/fulguriolightcms/img/thumb_pdf.png');
        }
        else
        {
            return 'http://www.placehold.it/' . $size['width'] . 'x' . $size['height'] . '/EFEFEF/AAAAAA';
        }
    }
311303
protected function _getMimeIcon( $mimetype )
	{
		$config = $this->_getContext()->getConfig();

		/** controller/extjs/media/default/mimeicon/directory
		 * Directory that contains the icons for the different mime types
		 *
		 * If no preview image can be generated from an uploaded file, an icon
		 * for its mime type is displayed instead. The directory for the mime
		 * icons is structured by the general mime type (e.g. "image") as
		 * sub-directory and the specific name of the mime type (e.g. "jpeg")
		 * as file name.
		 *
		 * The mime icon directory must be relative to the "basedir" configuration
		 * option. If
		 *
		 *  /var/www/test
		 *
		 * is the configured base directory and the upload directory should be
		 * located in
		 *
		 *  /var/www/test/media/mime
		 *
		 * then the configuration for the uploads directory must be
		 *
		 *  media/mime
		 *
		 * Avoid leading and trailing slashes for the upload directory string!
		 *
		 * @param string Path relative to the base directory
		 * @since 2014.03
		 * @category Developer
		 * @see controller/extjs/media/default/basedir
		 */
		if( ( $mimedir = $config->get( 'controller/extjs/media/default/mimeicon/directory', null ) ) === null )
		{
			$this->_getContext()->getLogger()->log( 'No directory for mime type images configured' );
			return '';
		}

		/** controller/extjs/media/default/mimeicon/extension
		 * File extension of the mime icon images
		 *
		 * If you would like to use different mime icons that are available in
		 * another file format, you have to change the file extension for the
		 * mime icons to the actual ones.
		 *
		 * Note: The configured file extension needs a leading dot!
		 *
		 * @param string File extension including a leading dot, e.g ".jpg"
		 * @since 2014.03
		 * @category Developer
		 */
		$ext = $config->get( 'controller/extjs/media/default/mimeicon/extension', '.png' );
		$abspath = $this->_getAbsoluteDirectory( $mimedir ) . DIRECTORY_SEPARATOR . $mimetype . $ext;
		$mimeicon = $mimedir . DIRECTORY_SEPARATOR . $mimetype . $ext;

		if( is_file( $abspath ) === false ) {
			$mimeicon = $mimedir . DIRECTORY_SEPARATOR . 'unknown' . $ext;
		}

		return $mimeicon;
	}
521833
public static function getStaticDataFileUrl( string $dataType, string $key = null, $locale = 'en_US', $version = null, string $fragment = null ): string
	{
		if (is_null($version))
			self::checkInit();

		return self::getCdnUrl() . ($version ?: self::getSetting(self::SET_VERSION)) . "/data/$locale/$dataType$key.json$fragment";
	}
118285
public static String getOfficialDataTypeURI(Datatype datatype) {
    	for(Uris uris : datatype.getUris()) {
    		for(Uri uri : uris.getUri()) {
    			if(!isDeprecated(uri) && uri.getType() == UriType.URN) {
    				return uri.getValue();
    			}
    		}
    	}
    	
    	return null;
    }
933417
static public BagObject url (String urlString, Bag postData, String postDataMimeType) {
        return url (urlString, postData, postDataMimeType, () -> null);
    }
20373
def mimetype(self):
        
        if ';' in self.headers.get('Content-Type', ''):
            return self.headers['Content-Type'].split(';')[0]
        return self.headers.get('Content-Type', self.static_format)