Click or drag to resize
AttachmentExtensionsGenerateVariant Method
Generates single image variant for given attachment. The variant is specified by definitionIdentifier parameter.

Namespace: CMS.DocumentEngine
Assembly: CMS.DocumentEngine (in CMS.DocumentEngine.dll) Version: 11.0.0
Syntax
C#
public static AttachmentInfo GenerateVariant(
	this AttachmentInfo attachment,
	IVariantContext context,
	string definitionIdentifier
)

Parameters

attachment
Type: CMS.DocumentEngineAttachmentInfo
Attachment info object.
context
Type: CMS.ResponsiveImagesIVariantContext
Variant processing context.
definitionIdentifier
Type: SystemString
Definition identifier.

Return Value

Type: AttachmentInfo
Generated image variant from the main attachment or null if variant did not generate.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type AttachmentInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when either of the parameters are null.
ArgumentExceptionThrown when definitionIdentifier is empty.
Remarks
Deletes an existing variant if the given variant definition is no longer applicable on the attachment.
See Also