使用ms bot、Channel.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET、C#.NET。Facebook, C#

问题描述 投票:1回答:1

我需要在机器人中发送图片,并将我的图片转换为字节数组。

在模拟器中图像正在发送,但在Facebook中,它没有发送。

下面是我的代码。

byte[] imageBytes12 = my image;
string url = "data:image/png;base64," + Convert.ToBase64String(imageBytes12);

var attachmentsImage = new List<Attachment>();
var replyImage = MessageFactory.Attachment(attachmentsImage);
HeroCard menuCardImage = Cards.HeroImageCard(url);
replyImage.Attachments.Add(menuCardImage.ToAttachment());
await stepContext.Context.SendActivityAsync(replyImage, cancellationToken);

我已经看到

当图像转换为字节时,它太长了,无法以ContentUrl的形式发送,这就是为什么失败的原因.Any help is appreciated.

谢谢你的帮助。

c# facebook botframework chatbot facebook-chatbot
1个回答
0
投票

当使用太大的图片作为数据URL时,你需要在服务器上提供图片的链接

© www.soinside.com 2019 - 2024. All rights reserved.