Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How could we include images from our computer? #19

Open
ManuMillenaar opened this issue Oct 10, 2018 · 8 comments
Open

How could we include images from our computer? #19

ManuMillenaar opened this issue Oct 10, 2018 · 8 comments

Comments

@ManuMillenaar
Copy link

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!

@kapkanov
Copy link

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))

@reesehopkins
Copy link

Thanks @apolivin, this works for me. However, I get a 400 error when the image is too large. This might be related to #34

@GitRon
Copy link

GitRon commented May 18, 2022

The image within this activity is tiny. Is there a way to post a properly-sized image?

@GitRon
Copy link

GitRon commented May 18, 2022

OK, maybe you could update the docs that you can easily use HTML for larger images? 🙈 Thx for the great package!

@LeonardoSanBenitez
Copy link

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" />")

@GitRon
Copy link

GitRon commented Aug 8, 2022

@LeonardoSanBenitez I know how to do it now but it's not mentioned in the docs 😃

@chongjae
Copy link

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?

@rveachkc
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants