[英]Display images using the Node.js Microsoft Bot Framework
So I have a first run dialog that asks the user to upload a photo. 因此,我有一个首次运行对话框,要求用户上传照片。 I do this via: 我这样做是通过:
builder.Prompts.attachment(session, "Thanks. Now upload a picture").
and then in the next part of the waterfall, saving the uploaded media to session.userData
like so: 然后在瀑布的下一部分中,将上传的媒体保存到session.userData
如下所示:
function(session, results) {
//some other code
builder.Prompts.attachment(session, "Thanks. Now upload a picture.");
},
function(session, results) {
session.userData.profilePhoto = results.response;
session.endDialog("All done.")
}
So, say I know want to display that photo. 所以,说我知道要显示该照片。 How would I do it? 我该怎么办?
I've tried sending a HeroCard
with a CardImage
: 我尝试发送带有HeroCard
的CardImage
:
var message = new builder.Message(session);
var att = new builder.HeroCard(session)
.images([
builder.CardImage.create(session, session.userData.profilePhoto)
])
.buttons([
builder.CardAction.openUrl(session, "http://google.com", "buttonText")
]);
message.addAttachment(att);
session.send(message)
but that didn't work (I also tried to do session.userData.profilePhoto.contentUrl
for the CardImage but that didnt work as well). 但这是行不通的(我也尝试过为CardImage做session.userData.profilePhoto.contentUrl
,但这也行不通)。
How exactly am I suppose to display images? 我应该如何精确显示图像?
UserData is not intended to store large objects, only state. UserData并非旨在存储大型对象,而仅用于存储状态。 Data bags are limited to 64k. 数据包限制为64k。 You'll want to use your own storage mechanism for images. 您将需要使用自己的图像存储机制。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.