Table of Contents

Class GetImageSettings

Namespace
Dynamicweb.Frontend
Assembly
Dynamicweb.dll

Represents the settings for GetImage.ashx link generation.

public sealed class GetImageSettings
Inheritance
GetImageSettings
Inherited Members

Constructors

GetImageSettings()

Initializes a new instance of the GetImageSettings class.

public GetImageSettings()

Properties

Crop

Gets or sets the crop mode. The crop mode defines how the image is cropped when resized.

public CropMode? Crop { get; set; }

Property Value

CropMode?

A crop mode using a CropMode option

Remarks

Default is null which will translate into KeepAspectRatio when image is generated When using Ratio and Width is set, the crop mode will be set to CenterOrFocal.

DoNotUpscale

Gets or sets a value indicating whether to upscale the image if the requested size is larger than the original image size.

public bool? DoNotUpscale { get; set; }

Property Value

bool?

true if upscaling is not allowed; otherwise, false.

Remarks

Default value is true. If crop mode KeepAspectRatio is used, DoNotUpscale is always set to true - this cannot be overridden.

Format

Gets or sets the image format.

public ImageType Format { get; set; }

Property Value

ImageType

The image format of the generated image.

Remarks

Default value is WebP

Height

Gets or sets the desired height of the image.

public int? Height { get; set; }

Property Value

int?

The height of the image in pixels, or null if the height is not specified.

Quality

Gets or sets the desired quality of the image.

public int? Quality { get; set; }

Property Value

int?

The Quality of the image in a relative value from 1-100, or null if the quality is not specified.

Remarks

webp supports -1 for lossless transformations. Jpg supports 1-100. Recommended value is 65-75. Invalid values are passed directly to GetImage that will report back errors

Ratio

Gets or sets the ratio required of the generated image.

public string? Ratio { get; set; }

Property Value

string

The ratio either as a fraction (21/9) or a decimal value (2.33).

Remarks

Use together with Width to calculate height based on the specified ratio. If ratio is set, the crop mode will be set to CenterOrFocal. E.g. a ratio of 1/1 will generate a square image, 16/9 will generate a widescreen image, 3/4 will generate a tall image. Using a width of 1280 and a ratio of 16/9 will generate an image with a height of 720 pixels (1280px / (16/9)).

RatioDefault

Gets or sets the default ratio to be used if no ratio is set on the image.

public string? RatioDefault { get; set; }

Property Value

string

The ratio either as a fraction (21/9) or a decimal value (2.33).

Remarks

If set, it will be used as the ratio when no ratio is set on the image.

Width

Gets or sets the desired width of the image.

public int? Width { get; set; }

Property Value

int?

The width of the image in pixels, or null if the width is not specified.

To top