Class ContentTypeUtil
Utility functions regarding ContentTypes
Inheritance
Namespace: ImageVault.Common.Lib.Web
Assembly: ImageVault.Common.dll
Syntax
public static class ContentTypeUtil : Object
Fields
ApplicationJson
application/json content type
Declaration
public const string ApplicationJson = "application/json"
Field Value
Type | Description |
---|---|
System.String |
ApplicationOctetStream
Gets the content-type for ApplicationOctetStream
Declaration
public const string ApplicationOctetStream = "application/octet-stream"
Field Value
Type | Description |
---|---|
System.String |
ApplicationPdf
Gets the ApplicationPdf of the ContentTypeUtil
Declaration
public const string ApplicationPdf = "application/pdf"
Field Value
Type | Description |
---|---|
System.String |
ApplicationPostscript
Get/Sets the ApplicationPostscript of the ContentTypeUtil
Declaration
public const string ApplicationPostscript = "application/postscript"
Field Value
Type | Description |
---|---|
System.String |
ApplicationXMpegUrl
application/x-mpegURL content type
Declaration
public const string ApplicationXMpegUrl = "application/x-mpegURL"
Field Value
Type | Description |
---|---|
System.String |
ApplicationZip
Gets the content-type for ApplicationZip
Declaration
public const string ApplicationZip = "application/zip"
Field Value
Type | Description |
---|---|
System.String |
ImageBmp
Bmp content type
Declaration
public const string ImageBmp = "image/bmp"
Field Value
Type | Description |
---|---|
System.String |
ImageEps
Gets the content-type for ImageEps
Declaration
public const string ImageEps = "image/eps"
Field Value
Type | Description |
---|---|
System.String |
ImageGif
Gets the content-type for ImageGif
Declaration
public const string ImageGif = "image/gif"
Field Value
Type | Description |
---|---|
System.String |
ImageJpeg
Gets the content-type for ImageJpeg
Declaration
public const string ImageJpeg = "image/jpeg"
Field Value
Type | Description |
---|---|
System.String |
ImageJpg
Gets the content-type for ImageJpg
Declaration
public const string ImageJpg = "image/jpg"
Field Value
Type | Description |
---|---|
System.String |
ImagePng
Gets the content-type for ImagePng
Declaration
public const string ImagePng = "image/png"
Field Value
Type | Description |
---|---|
System.String |
ImageSvg
The svg content type
Declaration
public const string ImageSvg = "image/svg+xml"
Field Value
Type | Description |
---|---|
System.String |
Remarks
ImageTiff
Gets the content-type for ImageTiff
Declaration
public const string ImageTiff = "image/tiff"
Field Value
Type | Description |
---|---|
System.String |
ImageWebP
Gets the content-type for WebP
Declaration
public const string ImageWebP = "image/webp"
Field Value
Type | Description |
---|---|
System.String |
MediaUnknown
Gets the content-type for MediaUnknown
Declaration
public const string MediaUnknown = "media/unknown"
Field Value
Type | Description |
---|---|
System.String |
TextPlain
Gets the TextPlain of the ContentTypeUtil
Declaration
public const string TextPlain = "text/plain"
Field Value
Type | Description |
---|---|
System.String |
TextVtt
text/vtt content type
Declaration
public const string TextVtt = "text/vtt"
Field Value
Type | Description |
---|---|
System.String |
VideoMp4
Gets the video/mp4 content type
Declaration
public const string VideoMp4 = "video/mp4"
Field Value
Type | Description |
---|---|
System.String |
Methods
CalculateContentType(MediaFormatOutputTypes, String)
Calculates the content type based on a conversion format type and an original content type
Declaration
public static string CalculateContentType(MediaFormatOutputTypes mediaFormatOutputType, string originalContentType)
Parameters
Type | Name | Description |
---|---|---|
MediaFormatOutputTypes | mediaFormatOutputType | The MediaFormatOutputTypes to calculate the content type for |
System.String | originalContentType | The original content type of the media |
Returns
Type | Description |
---|---|
System.String |
Remarks
This is only applicable for conversions to Image types. MediaFormatOutputTypes marked with WebSafe will act as if the asset is converted to an image
GetSubType(String)
Gets the subtype of the supplied content type
Declaration
public static string GetSubType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | The content type to get subtype for |
Returns
Type | Description |
---|---|
System.String | The subtype of the content type (type/subtype) |
GetType(String)
Gets the type of the supplied content type
Declaration
public static string GetType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | The content type to get type for |
Returns
Type | Description |
---|---|
System.String | The type of the content type (type/subtype) |
IsImage(String)
Checks if the supplied content type is an image
Declaration
public static bool IsImage(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType |
Returns
Type | Description |
---|---|
System.Boolean | True if it is image, otherwise false. |
IsVideo(String)
Checks if the supplied content type is a video
Declaration
public static bool IsVideo(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType |
Returns
Type | Description |
---|---|
System.Boolean | True if it is video, otherwise false. |
IsWebSafe(String)
Checks if a supplied ContentType is web safe or not
Declaration
public static bool IsWebSafe(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | The content type to check |
Returns
Type | Description |
---|---|
System.Boolean | True if web is safe, otherwise false. |