Click or drag to resize
ImageHelperEnsureImageDimensions Method (Int32, Int32, Int32, Int32, Int32)
Computes new image dimensions according to the specified parameters, and returns it.

Namespace: CMS.Helpers
Assembly: CMS.Helpers (in CMS.Helpers.dll) Version: 11.0.0
Syntax
C#
public static int[] EnsureImageDimensions(
	int width,
	int height,
	int maxSideSize,
	int imageWidth,
	int imageHeight
)

Parameters

width
Type: SystemInt32
Required image width (optional)
height
Type: SystemInt32
Required image height (optional)
maxSideSize
Type: SystemInt32
Required max image size (overrides both required width and height, optional)
imageWidth
Type: SystemInt32
Image width (required)
imageHeight
Type: SystemInt32
Image height (required)

Return Value

Type: Int32
An array with computed width ([0]) and height ([1])
Remarks
This method prevents image enlargement. Both image width and image height must be positive integers, otherwise specified image dimensions are returned. Specified image dimensions are also returned when neither width, height or maxSideSize is a positive integer.
See Also