问题
I would like to respond to a conversation by providing a barcode (.PNG) that has been base64 encoded. Is that possible? Or is the only method of delivery thru a Url.
回答1:
Try:
replyMessage.Attachments.Add(new Attachment()
{
ContentUrl = $"data:image/jpeg;base64,{Convert.ToBase64String(bdata)}"
});
Or as JSON:
{
"attachments":
[
{
"contentUrl": $"data:image/jpeg;base64,{Convert.ToBase64String(bdata)}"
}
]
}
Where bdata is a byte array
来源:https://stackoverflow.com/questions/37574157/how-can-i-send-a-base64-encoded-image