我需要在机器人中发送图片,并将我的图片转换为字节数组。
在模拟器中图像正在发送,但在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.
谢谢你的帮助。
当使用太大的图片作为数据URL时,你需要在服务器上提供图片的链接