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

tell whether selected image is jpg or png #65

Open
cory-baker opened this issue Jan 29, 2019 · 1 comment
Open

tell whether selected image is jpg or png #65

cory-baker opened this issue Jan 29, 2019 · 1 comment

Comments

@cory-baker
Copy link

Hi, I understand the source prop allows us to specify what type of base64 string to output (jpeg or png).

But is there a way to tell the source of the image?

Use case: firebase needs to know if the image is a png or jpg... i have no way of telling what kind of of file was selected. I hope this makes sense.

@Blutude
Copy link

Blutude commented Feb 18, 2019

imgstr is the base64 encoded string.
if imgstr[0] == '/': ext = 'jpg' elif imgstr[0] == 'i': ext = 'png'

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

2 participants