Class FormatUtilities
- Namespace
- SixLabors.ImageSharp.Web
- Assembly
- SixLabors.ImageSharp.Web.dll
Contains various helper methods for working with image formats based on the given configuration.
public sealed class FormatUtilities
- Inheritance
-
FormatUtilities
- Inherited Members
Constructors
FormatUtilities(IOptions<ImageSharpMiddlewareOptions>)
Initializes a new instance of the FormatUtilities class.
public FormatUtilities(IOptions<ImageSharpMiddlewareOptions> options)
Parameters
optionsIOptions<ImageSharpMiddlewareOptions>The middleware options.
Methods
GetExtensionFromContentType(string)
Gets the correct extension for the given content type (mime-type).
public string GetExtensionFromContentType(string contentType)
Parameters
contentTypestringThe content type (mime-type).
Returns
TryGetExtensionFromUri(string, out string?)
Gets the file extension for the given image uri.
public bool TryGetExtensionFromUri(string uri, out string? extension)
Parameters
uristringThe full request uri.
extensionstringWhen 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.