Class AdaptiveImage
Represents an adaptive image with three form factors.
Implements
Inherited Members
Namespace: AdaptiveImages.Models
Assembly: AdaptiveImages.dll
Syntax
[ContentType(GUID = "88f20953-0cec-4aab-a8f4-c164a49ca2c4", AvailableInEditMode = false, GroupName = "AdaptiveImages", Order = 10000)]
[JsonConverter(typeof(AdaptiveImageConverter))]
[JsonConverter(typeof(AdaptiveImageConverter))]
public class AdaptiveImage : BlockData, IContentData, IInitializableContent, IModifiedTrackable, IReadOnly<BlockData>, IReadOnly, IEquatable<AdaptiveImage>
Remarks
Most commonly used for responsive images.
Constructors
AdaptiveImage()
Creates a new AdaptiveImage instance.
Declaration
public AdaptiveImage()
AdaptiveImage(ContentReference)
Creates an adaptive image based on an existing CMS, i.e. ImageData, image.
Declaration
public AdaptiveImage(ContentReference contentReference)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentReference | contentReference | ContentReference for an ImageData instance. |
Remarks
This constructor is primarily intended for fallback scenarios where new AdaptiveImage properties should fall back to existing CMS image properties.
Properties
Large
Gets or sets the image for the desktop (largest) form factor.
Declaration
[Display(Order = 1)]
public virtual SingleImage Large { get; set; }
Property Value
| Type | Description |
|---|---|
| SingleImage |
Medium
Gets or sets the image for the tablet (medium) form factor.
Declaration
[Display(Order = 2)]
public virtual SingleImage Medium { get; set; }
Property Value
| Type | Description |
|---|---|
| SingleImage |
Small
Gets or sets the image for the mobile (smallest) form factor.
Declaration
[Display(Order = 3)]
public virtual SingleImage Small { get; set; }
Property Value
| Type | Description |
|---|---|
| SingleImage |
Methods
Equals(AdaptiveImage?)
Compares two AdaptiveImage instance by validating all form factors are identical, including crop points.
Declaration
public bool Equals(AdaptiveImage? other)
Parameters
| Type | Name | Description |
|---|---|---|
| AdaptiveImage | other | The other AdaptiveImage instance to compare to. |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object?)
Compares two AdaptiveImage instance by validating all form factors are identical, including crop points.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |