Class ThumbnailManager
Represents the thumbnail manager, for creating, cleaning thumbnail.
Inheritance
Namespace: EPiServer.Core.Internal
Assembly: EPiServer.dll
Version: 12.0.3Syntax
[ServiceConfiguration]
public class ThumbnailManager : Object
Constructors
ThumbnailManager(IContentRepository, IBlobFactory, IBlobResolver, IBlobAssigner, IImageService, IMimeTypeResolver, IImageDescriptorPropertyResolver)
Initializes a new instance of the ThumbnailManager class.
Declaration
public ThumbnailManager(IContentRepository contentRepository, IBlobFactory blobFactory, IBlobResolver blobResolver, IBlobAssigner blobAssigner, IImageService imageService, IMimeTypeResolver mimeTypeResolver, IImageDescriptorPropertyResolver imageDescriptorResolver)
Parameters
Type | Name | Description |
---|---|---|
IContentRepository | contentRepository | |
IBlobFactory | blobFactory | |
IBlobResolver | blobResolver | |
IBlobAssigner | blobAssigner | |
IImageService | imageService | |
IMimeTypeResolver | mimeTypeResolver | |
IImageDescriptorPropertyResolver | imageDescriptorResolver |
Fields
DefaultThumbnail
Declaration
public static byte[] DefaultThumbnail
Field Value
Type | Description |
---|---|
System.Byte[] |
Properties
ImageService
Gets or sets the image service.
Declaration
public virtual IImageService ImageService { get; set; }
Property Value
Type | Description |
---|---|
IImageService | The image service. |
Remarks
This is mainly exposed for unit test purposes.
Methods
CleanThumbnail(ContentReference, Boolean)
Clean all content's thumbnail properties. If the contentLink
is not IContentMedia, nothing will be cleaned up.
Declaration
public int CleanThumbnail(ContentReference contentLink, bool saveContent)
Parameters
Type | Name | Description |
---|---|---|
ContentReference | contentLink | Content link of the content to clean thumnail. |
System.Boolean | saveContent | Flag to indicate whether the content should be saved or not. |
Returns
Type | Description |
---|---|
System.Int32 | Number of thumbnail properties have been cleared. |
CleanThumbnail(IContentMedia, Boolean)
Clean all content's thumbnail properties.
Declaration
public int CleanThumbnail(IContentMedia content, bool saveContent)
Parameters
Type | Name | Description |
---|---|---|
IContentMedia | content | Content to clean thumbnail. |
System.Boolean | saveContent | Flag to indicate whether the content should be saved or not. |
Returns
Type | Description |
---|---|
System.Int32 | Number of thumbnail properties have been cleared. |
CreateBlob(Uri, Blob, Int32, Int32)
Create a thumbnail image
Declaration
public virtual Blob CreateBlob(Uri thumbnailUri, Blob blobSource, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | thumbnailUri | The Uri of thumbnail |
Blob | blobSource | The source blob |
System.Int32 | width | The width of thumbnail |
System.Int32 | height | The height of thumbnail |
Returns
Type | Description |
---|---|
Blob | The blob thumbnail |
CreateImageBlob(Blob, String, ImageDescriptorAttribute)
Get transparent-background thumbnail for content
Declaration
public virtual Blob CreateImageBlob(Blob sourceBlob, string propertyName, ImageDescriptorAttribute descriptorAttribute)
Parameters
Type | Name | Description |
---|---|---|
Blob | sourceBlob | Source blob to get scaled image from. |
System.String | propertyName | Name of the property. |
ImageDescriptorAttribute | descriptorAttribute | The descriptor attribute. |
Returns
Type | Description |
---|---|
Blob | The blob thumbnail |
CreateThumbnailUri(Blob, String)
Get the Blob identified for a thumbnail
Declaration
public static Uri CreateThumbnailUri(Blob sourceBlob, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
Blob | sourceBlob | The source blob / image |
System.String | propertyName | The name of the property of the thumbnail |
Returns
Type | Description |
---|---|
System.Uri |
GetDescendentsMedia()
Returns all content reference under media and asset folder roots.
Declaration
public IEnumerable<ContentReference> GetDescendentsMedia()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ContentReference> | All content reference under media and asset folder roots. |
GetImageDescriptorProperties(IContentData)
Declaration
public IEnumerable<BlobResolveResult> GetImageDescriptorProperties(IContentData content)
Parameters
Type | Name | Description |
---|---|---|
IContentData | content |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<BlobResolveResult> |