Documentation > CMS Template API Library > Img

CrownPeak.CMSAPI.Img

Functions for using and manipulating images

NameDescriptionType
CreateThumbnail

Creates a thumbnail of the specified size from the currently loaded image. A ThumbnailKey is required. The resulting image will be in memory. Use Asset.CreateThumbnail, PanelEntry.CreateThumbnail, or ImageForm.CreateThumbnail to preserve the data. Note: Due to memory limitations, the pixel count of the source image cannot be more than 10 million.

Method
CropImage

Crop a an image out of the original (current instance) using the coordinate defined by x,y,xx,yy, then scale it using width and height as in the CreateThumbnail call. The final image dimensions will not necessarily match the width and height unless the aspect ratio is preserved.

Method
Load

Loads the specified Image based on the given asset. It must be the path of an uploaded image. It cannot have a template. If there is an attachment, you would pass the path of the attachment. If the image cannot be loaded, check the Img.HasError property

Method
Load

Loads an image using the specified CMS assetPath.

Method
Load

Loads an image using the specified CMS path.

Method
Load

Loads an image using an uploaded file.

Method
ErrorMessage

If there was an error while loading this image a message will be here. Check HasError to see if an error happened

Property
Filename

The CMS path to the file. Use it when you have just generated a new thumbnail to get a path that can be used in an img src call.

Property
HasError

Use to check if there was an error while loading. Use ErrorMessage to see a description.

Property
Height

Gets the height.

Property
Width

Gets the width.

Property

Connect with Crownpeak