createResizedStreamCdnImageUrl

fun String.createResizedStreamCdnImageUrl(@FloatRange(from = 0.0, to = 1.0, fromInclusive = false) resizedWidthPercentage: Float, @FloatRange(from = 0.0, to = 1.0, fromInclusive = false) resizedHeightPercentage: Float, resizeMode: StreamCdnResizeImageMode? = null, cropMode: StreamCdnCropImageMode? = null): String

Generates a string URL with Stream CDN image resizing query parameters added to it. Once this URL is called, Stream's CDN will generate a resized image which is accessible using the link returned by this function.

Parameters

resizedWidthPercentage

The percentage of the original image width the resized image width will be.

resizedHeightPercentage

The percentage of the original image height the resized image height will be.

resizeMode

Sets the image resizing mode. The default mode is StreamCdnResizeImageMode.CLIP.

cropMode

Sets the image crop mode. The default mode is StreamCdnCropImageMode.CENTER.


fun String.createResizedStreamCdnImageUrl(maxImagePixels: Long, resizeMode: StreamCdnResizeImageMode? = null, cropMode: StreamCdnCropImageMode? = null, cdnHost: String? = null): String

Generates a URL with Stream CDN resizing parameters that cap the image to maxImagePixels total pixels (width × height), preserving aspect ratio and never upscaling. Mirrors the iOS SDK's imageAttachmentMaxPixels. Only affects images served from a Stream CDN host (see cdnHost) that carry original width (ow) and height (oh) params; any other URL, or one already at/under the budget, is returned unchanged.

Parameters

cdnHost

An optional custom Stream CDN host to resize in addition to the default Stream CDN hosts, for integrations serving Stream images from a proxied or custom domain. Mirrors iOS' StreamCDNRequester(cdnHost:).