Class FormatUtilities
Contains various helper methods for working with image formats based on the given configuration.
Inherited Members
Namespace: SixLabors.ImageSharp.Web
Assembly: SixLabors.ImageSharp.Web.dll
Syntax
public sealed class FormatUtilities
Constructors
| Improve this Doc View SourceFormatUtilities(IOptions<ImageSharpMiddlewareOptions>)
Initializes a new instance of the FormatUtilities class.
Declaration
public FormatUtilities(IOptions<ImageSharpMiddlewareOptions> options)
Parameters
Type | Name | Description |
---|---|---|
IOptions<ImageSharpMiddlewareOptions> | options | The middleware options. |
Methods
| Improve this Doc View SourceGetExtensionFromContentType(String)
Gets the correct extension for the given content type (mime-type).
Declaration
public string GetExtensionFromContentType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
String | contentType | The content type (mime-type). |
Returns
Type | Description |
---|---|
String | The String. |
TryGetExtensionFromUri(String, out String)
Gets the file extension for the given image uri.
Declaration
public bool TryGetExtensionFromUri(string uri, out string extension)
Parameters
Type | Name | Description |
---|---|---|
String | uri | The full request uri. |
String | extension | When this method returns, contains the file extension for the image source, if the path exists; otherwise, the default value for the type of the path parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
Boolean | true if the uri contains an extension; otherwise, false. |