Open ManuMillenaar opened 6 years ago
You should encode image via base64
with open("path/to/image.jpg", "rb") as img_file:
encoded = base64.b64encode(img_file.read()).decode('ascii')
Session1.activityImage("data:image/jpeg;base64, "+str(encoded))
Thanks @apolivin, this works for me. However, I get a 400 error when the image is too large. This might be related to #34
The image within this activity is tiny. Is there a way to post a properly-sized image?
OK, maybe you could update the docs that you can easily use HTML for larger images? 🙈 Thx for the great package!
You can include an image as HTML, in a text block, as follows:
myTeamsMessage.text("<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />")
@LeonardoSanBenitez I know how to do it now but it's not mentioned in the docs 😃
I want to attach about 119Kb png file. But, when i sent image, teams show below msg.
This message is too long to display here. Please visit the external source app to view the message.
How can i attach image?
I want to attach about 119Kb png file. But, when i sent image, teams show below msg.
This message is too long to display here. Please visit the external source app to view the message.
How can i attach image?
It's a limitation of the api. The error message is suggesting you make the image available via external service, then link to it.
It's only possible to add images from a URL, right?
Also, the hero image in the center would be super cool to have, if possible.
Thanks so much!