Twilio可编程聊天以blob形式发送媒体

时间:2018-07-17 07:57:16

标签: twilio twilio-api twilio-programmable-chat

在我们的Web应用程序中,Twilio聊天允许用户发送图像。我想在同一聊天对话中重新发送该图像,并在图像上添加注释。 对于新图片上传,我使用

const formData = new FormData();
formData.append('file', $('#imageFile')[0].files[0]);
myChatData.sendMessage(formData);

要在带有注释的聊天对话中重新发送相同的图像,我只有图像base64 url​​。所以,我尝试了

var url = $("#chatQuesImage").attr('src');              
var blob = dataURLtoBlob(url);
var fd = new FormData(document.forms[0]);
fd.append("file", blob, "image.jpg");
myChatData.sendMessage(fd);

这是我尝试使用上述代码enter image description here上传的示例 这就是我得到的enter image description here

请指导我如何向聊天消息发送图片网址。

0 个答案:

没有答案
相关问题