@Composable public fun FileAttachmentImage(attachment: Attachment) {val isImage = attachment.type == "image"val painter = if (isImage) {val dataToLoad = attachment.imageUrl ?: attachment.upload rememberStreamImagePainter(dataToLoad)} else {painterResource(id = MimeTypeIconProvider.getIconRes(attachment.mimeType))} val shape = if (isImage) ChatTheme.shapes.imageThumbnail else nullval imageModifier = Modifier.size(height = 40.dp, width = 35.dp).let { baseModifier -> if (shape != null) baseModifier.clip(shape) else baseModifier } Image(modifier = imageModifier, painter = painter, contentDescription = null, contentScale = if (isImage) ContentScale.Crop else ContentScale.Fit) }
Represents the image that's shown in file attachments. This can be either an image/icon that represents the file type or a thumbnail in case the file type is an image.