botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Hero Cards showing images in different height

Open sajadhaja opened this issue 9 years ago • 1 comments

  • SDK Platform: NodeJS
  • SDK Version: Botbuilder 3.1.1
  • Active Channels: Skype/Web
  • Deployment Environment: ngrok, BotEmulator

Issue Description

Images showing in hero cards in different width and height. How to show it in a equal size?

Code Example

 var msg = new botbuilder.Message(session);
        msg.attachmentLayout(botbuilder.AttachmentLayout.carousel)
        var attachments = [];
        for (let messageIndex = 0; messageIndex < messages.length; messageIndex++) {
            let message = messages[messageIndex];
            let attch = new botbuilder.HeroCard(session)
                .title(message.title)
                .subtitle(message.subtitle)
                .text(message.text)
                .images([botbuilder.CardImage.create(session, message.images)])
                .buttons([
                    botbuilder.CardAction.imBack(session, message.buttonValue, message.buttonText)
                ]);
            attachments.push(attch);
        }
        msg.attachments(attachments);
        session.sendTyping()
        session.endConversation(msg).endDialog();

sajadhaja avatar Oct 04 '17 07:10 sajadhaja

I do not see a way to programmatically change the size of the images for a HeroCard within the SDK. You have some other options though. First, you could use adaptive cards. With adaptive cards, you have many more options to customize. Your second option would be to edit the photos so they are the same size, to begin with. This will probably b the easiest way if you are able to do it.

JasonSowers avatar Oct 04 '17 18:10 JasonSowers