fix image serializing - REF-1889#2550
Merged
masenf merged 4 commits intoreflex-dev:mainfrom Feb 22, 2024
Merged
Conversation
masenf
requested changes
Feb 7, 2024
| image_bytes = buff.getvalue() | ||
| base64_image = base64.b64encode(image_bytes).decode("utf-8") | ||
| mime_type = getattr(image, "get_format_mimetype", lambda: "image/png")() | ||
| mime_type = getattr(image, "get_format", lambda: "image/png")() |
Collaborator
There was a problem hiding this comment.
i don't think get_format is actually valid here... when i examine the resulting mime_type, it comes out as image/png, even thought the image is actually a jpeg
Throw a warning if the image format does not have an associated MIME type and ultimately fallback to image/png and let the browser figure it out.
picklelo
approved these changes
Feb 22, 2024
masenf
approved these changes
Feb 22, 2024
Yummy-Yums
pushed a commit
to Yummy-Yums/reflex-codebase
that referenced
this pull request
Feb 28, 2024
* fix image serializing * If get_format_mimetype does not work, look up format in Image.MIME Throw a warning if the image format does not have an associated MIME type and ultimately fallback to image/png and let the browser figure it out. * test_media: end to end serialization of PIL images --------- Co-authored-by: Masen Furer <m_github@0x26.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
After these steps, you're ready to open a pull request.