Reputation: 2375
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:
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
:
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).
How exactly am I suppose to display images?
Upvotes: 0
Views: 888
Reputation: 10573
UserData is not intended to store large objects, only state. Data bags are limited to 64k. You'll want to use your own storage mechanism for images.
Upvotes: 1