Skylar-Tech / node-red-contrib-matrix-chat

Matrix chat server support for Node-RED
GNU General Public License v3.0
31 stars 10 forks source link

Node-red send image to matrix room #101

Open unknown1818 opened 8 months ago

unknown1818 commented 8 months ago

Hi,

I fighting with this many hours, whats the proper way to send image to matrix room via function node?

inject node: msg.image_url = https://fastly.picsum.photos/id/793/536/354.jpg?hmac=XIFVAzAu0yVaOvzskKwSbjpxtJ4eBif_HtCf92kxsMs

---->

msg.payload = { 
    "url": msg.image_url, 
    "info": { 
        "mimetype": "image/jpg"
    } 
}
return msg;

---->

Matrix send image node

im always getting blank message

msg.payload File | string | Buffer | ReadStream | Blob the contents of the image to upload.

what i should have inside msg.payload? image url? can you provide some examples

skylord123 commented 8 months ago

Here is an example of how to use the send image node: https://github.com/Skylar-Tech/node-red-contrib-matrix-chat/blob/master/examples/README.md#respond-to-image-with-an-uploaded-image

If the image is a remote URL you need to fetch it (with something like an HTTP node) then pass it to the send image node. The mime type MUST be set correctly.