How can I send an image on the web in an XMPP (Jabber) message?

后端 未结 3 1614
无人及你
无人及你 2021-02-13 16:37

For the XMPP interface for the Stack Overflow chat, I am currently taking the HTML of the chat messages and converting to valid XML, and setting that as the html ch

相关标签:
3条回答
  • 2021-02-13 17:00

    Just an idea...

    What about parsing the image URL's, downloading the images, putting them into a temp folder with filenames representative of the original URLs (the filename could be a hash of the original URL) and substituting the original URLs in the messages for these file URLs?

    Another idea... having a local server that fetches the real URLs?

    0 讨论(0)
  • 2021-02-13 17:01

    Try embedding it in a data: uri, like <img src="data:image/png;base64,VGhlIGltYWdlIGRhdGEgZ29lcyBoZXJlCg==" alt="some text" />

    0 讨论(0)
  • 2021-02-13 17:11

    Adium, iChat and Pidgin all support XEP-0231, which allows you to send the provide binary data, including images to this purpose. Basically, it allows you to specify a unique identifier as the source for an image, and then the other client can decide if he wants to request the data in a <iq> request.

    I've been working with this in python's Twisted, but meeting with some frustration. I do know that Adium and iChat at least use it to request the data.

    0 讨论(0)
提交回复
热议问题