Skip to main content
Version: v4

AttachmentConfigurationService

The AttachmentConfigurationService provides customization for certain attributes of attachments displayed inside the message component. If you're using your own CDN, you can integrate resizing features of it by providing your own handlers.

Type parameters

NameType
Textends DefaultStreamChatGenerics = DefaultStreamChatGenerics

Properties

customGiphyAttachmentConfigurationHandler

Optional customGiphyAttachmentConfigurationHandler: (a: Attachment<T>) => AttachmentConfigration

Type declaration

▸ (a): AttachmentConfigration

A custom handler can be provided to override the default giphy attachment (GIFs sent with the /giphy command) configuration. By default the SDK uses fixed height (a size that's known before the GIF is loaded), if you override that with dynamic height (for example: height: 100%) the scrolling logic inside the message list can break.

Parameters
NameType
aAttachment<T>
Returns

AttachmentConfigration

Defined in

lib/attachment-configuration.service.ts:37


customImageAttachmentConfigurationHandler

Optional customImageAttachmentConfigurationHandler: (a: Attachment<T>, type: "gallery" | "single" | "carousel", containerElement: HTMLElement) => ImageAttachmentConfiguration

Type declaration

▸ (a, type, containerElement): ImageAttachmentConfiguration

A custom handler can be provided to override the default image attachment (images uploaded from files) configuration. By default the SDK uses fixed image height (a size that's known before image is loaded), if you override that with dynamic image height (for example: height: 100%) the scrolling logic inside the message list can break.

Parameters
NameType
aAttachment<T>
type"gallery" | "single" | "carousel"
containerElementHTMLElement
Returns

ImageAttachmentConfiguration

Defined in

lib/attachment-configuration.service.ts:22


customScrapedImageAttachmentConfigurationHandler

Optional customScrapedImageAttachmentConfigurationHandler: (a: Attachment<T>) => AttachmentConfigration

Type declaration

▸ (a): AttachmentConfigration

A custom handler can be provided to override the default scraped image attachment (images found in links inside messages) configuration. By default the SDK uses fixed height (a size that's known before image is loaded), if you override that with dynamic height (for example: height: 100%) the scrolling logic inside the message list can break.

Parameters
NameType
aAttachment<T>
Returns

AttachmentConfigration

Defined in

lib/attachment-configuration.service.ts:43


customVideoAttachmentConfigurationHandler

Optional customVideoAttachmentConfigurationHandler: (a: Attachment<T>, containerElement: HTMLElement) => VideoAttachmentConfiguration

Type declaration

▸ (a, containerElement): VideoAttachmentConfiguration

A custom handler can be provided to override the default video attachment (videos uploaded from files) configuration. By default the SDK uses fixed height (a size that's known before video is loaded), if you override that with dynamic height (for example: height: 100%) the scrolling logic inside the message list can break.

Parameters
NameType
aAttachment<T>
containerElementHTMLElement
Returns

VideoAttachmentConfiguration

Defined in

lib/attachment-configuration.service.ts:30


shouldGenerateVideoThumbnail

shouldGenerateVideoThumbnail: boolean = true

You can turn on/off thumbnail generation for video attachments

Defined in

lib/attachment-configuration.service.ts:49

Methods

getGiphyAttachmentConfiguration

getGiphyAttachmentConfiguration(attachment): AttachmentConfigration

Handles the configuration for giphy attachments, it's possible to provide your own function to override the default logic

Parameters

NameTypeDescription
attachmentAttachment<T>The attachment to configure

Returns

AttachmentConfigration

Defined in

lib/attachment-configuration.service.ts:180


getImageAttachmentConfiguration

getImageAttachmentConfiguration(attachment, location, element): ImageAttachmentConfiguration

Handles the configuration for image attachments, it's possible to provide your own function to override the default logic

Parameters

NameTypeDescription
attachmentAttachment<T>The attachment to configure
location"gallery" | "single" | "carousel"Specifies where the image is being displayed
elementHTMLElementThe default resizing logics reads the height/max-height and max-width propperties of this element and reduces file size based on the given values. File size reduction is done by Stream's CDN.

Returns

ImageAttachmentConfiguration

Defined in

lib/attachment-configuration.service.ts:57


getScrapedImageAttachmentConfiguration

getScrapedImageAttachmentConfiguration(attachment): AttachmentConfigration

Handles the configuration for scraped image attachments, it's possible to provide your own function to override the default logic

Parameters

NameTypeDescription
attachmentAttachment<T>The attachment to configure

Returns

AttachmentConfigration

Defined in

lib/attachment-configuration.service.ts:200


getVideoAttachmentConfiguration

getVideoAttachmentConfiguration(attachment, element): VideoAttachmentConfiguration

Handles the configuration for video attachments, it's possible to provide your own function to override the default logic

Parameters

NameTypeDescription
attachmentAttachment<T>The attachment to configure
elementHTMLElementThe default resizing logics reads the height/max-height and max-width propperties of this element and reduces file size based on the given values. File size reduction is done by Stream's CDN.

Returns

VideoAttachmentConfiguration

Defined in

lib/attachment-configuration.service.ts:123

Did you find this page helpful?