How to render RadChat Image Attachement?

1 Answer 17 Views
Chat
Randy
Top achievements
Rank 1
Iron
Randy asked on 01 Sep 2021, 07:57 AM

I tried to render an image attachment but it gives an empty bubble. Can anyone provide a working sample?

 

 

chat.renderAttachments({
            attachments: [{
                contentType: "image_card",
                content: {
                }
            }],
            attachmentLayout: "list"
        }, chat.get_user());

1 Answer, 1 is accepted

Sort by
1
Accepted
Vessy
Telerik team
answered on 01 Sep 2021, 12:42 PM

Hello Randy,

Changing the contentType of the attachment to heroCard and setting the image path to its url option will allow you to render the attachment successfully:

https://dojo.telerik.com/ALaqOgez/2

    chat.renderAttachments({
        attachments: [{
            contentType: "heroCard",
            content: {
                images: [{
                    url: "https://media0.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif?cid=3640f6095bf5990153692f462ed33eaa",
                }]
            }
        }],
        attachmentLayout: "list"
    }, chat.getUser());

Regards,
Vessy
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Randy
Top achievements
Rank 1
Iron
commented on 01 Sep 2021, 07:00 PM | edited

Thank you. 
Randy
Top achievements
Rank 1
Iron
commented on 01 Sep 2021, 07:44 PM

How to set it right to align?
Peter Milchev
Telerik team
commented on 06 Sep 2021, 09:17 AM

Hi Randy, the attachments are currently not designed to reflect the user but to be rendered at the same position always. Nevertheless, after adding the attachments, you can add a CSS class to the last list item and set the align-self: flex-end and achieve the right-aligned appearance:

Tags
Chat
Asked by
Randy
Top achievements
Rank 1
Iron
Answers by
Vessy
Telerik team
Share this question
or