New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Represents a provider for images of a RadImageEditor instance. It stores the images into Cache or Session.

Definition

Namespace:Telerik.Web.UI.ImageEditor

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class CacheImageProvider : ICacheImageProvider

Inheritance: objectCacheImageProvider

Implements: ICacheImageProvider

Inherited Members object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

Creates an instance of the CacheImageProvider class.

C#
public CacheImageProvider()

Creates an instance of the CacheImageProvider class.

C#
public CacheImageProvider(ImageStorage storage, string imageStorageKey)
Parameters:storageImageStorage

The ImageStorage location where the EditableImage objects will be stored.

imageStorageKeystring

The unique key associated with the current instance of the RadImageEditor.

Creates an instance of the CacheImageProvider class.

C#
public CacheImageProvider(ImageStorage storage)
Parameters:storageImageStorage

The ImageStorage location where the EditableImage objects will be stored.

Properties

Gets or sets a unique key that used to associate the current RadImageEditor instance with the images stored by the provider. This property is set by the RadImageEditor instance.

The RadImageEditor class provides exactly the same property, and the provider and the corresponding ImageEditor instance have the same value.

C#
public string ImageStorageKey { get; set; }

Implements: ICacheImageProvider.ImageStorageKey

Gets or sets the location where the EditableImage objects will be stored. This property is set by the RadImageEditor instance.

C#
public ImageStorage Storage { get; set; }

Implements: ICacheImageProvider.Storage

Methods

Clears all images currently saved by the provider.

C#
public virtual void ClearImages()

Implements: ICacheImageProvider.ClearImages()

Clears the images in the provider up to the image key passed.

The clearing is done from the first image that was placed by the provider, up to the one corresponding to the key. The image that corresponds to the key is not cleared.

C#
public virtual void ClearImages(string imageKey)
Parameters:imageKeystring

The key up to which the images are cleared.

Implements: ICacheImageProvider.ClearImages(string)

Deletes a file from the FileSystem and returns a string.Empty if the action was successful.

C#
protected virtual string DeleteFile(string physicalPath)
Parameters:physicalPathstring

The physical path to the file.

Returns:

string

String.Empty if the deletion was successful.

"FileReadOnly" if the file exists and it is read only. The file is not deleted.

"NoPermissionsToDeleteFile" if the deletion was successful. The file is not deleted.

Gets a file from the FileSystem.

C#
protected virtual Stream GetFile(string physicalPath)
Parameters:physicalPathstring

The physicalPath of the file.

Returns:

Stream

The file stream. Null if the file does not exist.

Loads an image from the specified location. This image will be used to create an EditableImage object.

C#
public virtual Image LoadImage(string imageUrl, string physicalPath, HttpContext context)
Parameters:imageUrlstring

The path to the image to load.

physicalPathstring

The physical path to the image to load.

contextHttpContext

The HttpContext to which the application belongs.

Returns:

Image

Returns the Image object loaded from the specified location.

Implements: ICacheImageProvider.LoadImage(string, string, HttpContext)

Retrieves an EditableImage from the provider.

C#
public virtual EditableImage Retrieve(string key)
Parameters:keystring

The key that corresponds to the editable image.

Returns:

EditableImage

An EditableImage object that corresponds to the key passed.

Implements: ICacheImageProvider.Retrieve(string)

Saves the current image on the FileSystem and returns a string.Empty if the saving was successful.

C#
public virtual string SaveImage(EditableImage editableImage, string physicalPath, string imageUrl, bool overwrite)
Parameters:editableImageEditableImage

The EditableImage to save.

physicalPathstring

The full physical path (including the file name) where the image will be saved.

imageUrlstring

The path (relative) to the image that is currently loaded in the ImageEditor. If new image name was specified when saving the image, it will be reflected in the imageUrl.

overwritebool

Should we overwrite the file if it exists.

Returns:

string

String.Empty if the operation was successful, else a string indicating the problem.

Implements: ICacheImageProvider.SaveImage(EditableImage, string, string, bool)

Stores an image, generates key that corresponds to the stored image, and returns the key.

C#
public virtual string Store(EditableImage image)
Parameters:imageEditableImage

The EditableImage object to store.

Returns:

string

The key that corresponds to the stored editable image.

Implements: ICacheImageProvider.Store(EditableImage)