Interface IImageService
Represents a service for manipulating images.
Namespace: DataWeb.Media
Assembly: DataWeb.Core.dll
Syntax
public interface IImageService
Properties
Name
Gets the name of the service.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
CreateThumbnail(IFile, ThumbnailDefinition, int, int, ResizeMode, bool, bool, string, Func<object, Task>, CancellationToken)
Creates a thumbnail for the specified file with the specified dimensions and resize mode.
Declaration
Task CreateThumbnail(IFile file, ThumbnailDefinition thumbnailDefinition, int width, int height, ResizeMode resizeMode = ResizeMode.Fix, bool isMetaDataRemoval = false, bool isCutDisabled = false, string imageContext = null, Func<object, Task> imageProcessDelegate = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IFile | file | The IFile to create the thumbnail for. |
ThumbnailDefinition | thumbnailDefinition | |
int | width | The desired width of the thumbnail. |
int | height | The desired height of the thumbnail. |
ResizeMode | resizeMode | The ResizeMode of the thumbnail. |
bool | isMetaDataRemoval | Removes meta data from thumbnail. |
bool | isCutDisabled | |
string | imageContext | |
Func<object, Task> | imageProcessDelegate | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
DeleteThumbnailsAsync(CancellationToken)
Deletes all thumbnails generated by the service.
Declaration
Task DeleteThumbnailsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
GetImageFormatAsync(Stream, CancellationToken)
Gets the image format of the specified stream.
Declaration
Task<string> GetImageFormatAsync(Stream stream, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to get the image format for. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | The image format of the specified stream, or |
GetThumbnailDefinition(IFile)
Gets the thumbnail definition.
Declaration
ThumbnailDefinition GetThumbnailDefinition(IFile file)
Parameters
Type | Name | Description |
---|---|---|
IFile | file | The IFile to create the thumbnail for. |
Returns
Type | Description |
---|---|
ThumbnailDefinition | A ThumbnailDefinition for thumbnail handling |
GetThumbnailStreamAsync(IFile, ThumbnailDefinition, int, int, ResizeMode, bool, string, CancellationToken)
Gets a stream containing the thumbnail for the specified file with the specified dimensions and resize mode.
Declaration
Task<Stream> GetThumbnailStreamAsync(IFile file, ThumbnailDefinition thumbnailDefinition, int width, int height, ResizeMode resizeMode = ResizeMode.Fix, bool isCutDisabled = false, string imageContext = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IFile | file | The IFile to retrieve the thumbnail for. |
ThumbnailDefinition | thumbnailDefinition | |
int | width | The desired width of the thumbnail. |
int | height | The desired height of the thumbnail. |
ResizeMode | resizeMode | The ResizeMode of the thumbnail. |
bool | isCutDisabled | |
string | imageContext | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Stream> | A stream containing the thumbnail for the specified file, or |
IsThumbnailAsync(IFile, ThumbnailDefinition, int, int, ResizeMode, bool, string, CancellationToken)
Determines whether the specified file has a thumbnail with the specified dimensions and resize mode.
Declaration
Task<bool> IsThumbnailAsync(IFile file, ThumbnailDefinition thumbnailDefinition, int width, int height, ResizeMode resizeMode = ResizeMode.Fix, bool isCutDisabled = false, string imageContext = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IFile | file | The IFile to check. |
ThumbnailDefinition | thumbnailDefinition | |
int | width | The desired width of the thumbnail. |
int | height | The desired height of the thumbnail. |
ResizeMode | resizeMode | The ResizeMode of the thumbnail. |
bool | isCutDisabled | |
string | imageContext | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> |
|