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
| Edit this page 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
| Edit this page 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 |
---|---|
bool |