[RNMobile] Fix Image Size when url for slug doesn't exist.#18698
Merged
[RNMobile] Fix Image Size when url for slug doesn't exist.#18698
Conversation
1 task
SergioEstevao
approved these changes
Nov 25, 2019
Contributor
SergioEstevao
left a comment
There was a problem hiding this comment.
Thanks for this fix! ![]()
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.
Description
Fixes n7 from wordpress-mobile/gutenberg-mobile#1593
gutenberg-mobilePR: wordpress-mobile/gutenberg-mobile#1611This issue has been possible to be reproduce on Pressable sites:
Largesize image, so there won't be url for the Large image option. In the same way, when the image is big enough, it generates many other size options not shown on the UI (including on web).An example from a small image:
{ "width": 499, "height": 333, "file": "2019/11/11769619264_5e93c3e4d2-1.jpg", "sizes": { "medium": { "file": "11769619264_5e93c3e4d2-1-300x200.jpg", "width": 300, "height": 200, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/11769619264_5e93c3e4d2-1-300x200.jpg" }, "thumbnail": { "file": "11769619264_5e93c3e4d2-1-150x150.jpg", "width": 150, "height": 150, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/11769619264_5e93c3e4d2-1-150x150.jpg" }, "full": { "file": "11769619264_5e93c3e4d2-1.jpg", "width": 499, "height": 333, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/11769619264_5e93c3e4d2-1.jpg" } }, }This is a big image:
{ "width": 2560, "height": 1440, "file": "2019/11/beautiful-blur-bright-326055-1-scaled.jpg", "sizes": { "medium": { "file": "beautiful-blur-bright-326055-1-300x169.jpg", "width": 300, "height": 169, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-300x169.jpg" }, "large": { "file": "beautiful-blur-bright-326055-1-1024x576.jpg", "width": 1024, "height": 576, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-1024x576.jpg" }, "thumbnail": { "file": "beautiful-blur-bright-326055-1-150x150.jpg", "width": 150, "height": 150, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-150x150.jpg" }, "medium_large": { "file": "beautiful-blur-bright-326055-1-768x432.jpg", "width": 768, "height": 432, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-768x432.jpg" }, "1536x1536": { "file": "beautiful-blur-bright-326055-1-1536x864.jpg", "width": 1536, "height": 864, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-1536x864.jpg" }, "2048x2048": { "file": "beautiful-blur-bright-326055-1-2048x1152.jpg", "width": 2048, "height": 1152, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-2048x1152.jpg" }, "post-thumbnail": { "file": "beautiful-blur-bright-326055-1-1568x882.jpg", "width": 1568, "height": 882, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-1568x882.jpg" }, "full": { "file": "beautiful-blur-bright-326055-1-scaled.jpg", "width": 2560, "height": 1440, "mime_type": "image/jpeg", "source_url": "https://testingsiteetoledom.mystagingwebsite.com/wp-content/uploads/2019/11/beautiful-blur-bright-326055-1-scaled.jpg" } }, }The changes on this PR are just to avoid the issue where the image disappears if the url doesn't exist for the Large slug (the default one), leaving the original url instead. This is how currently "works" on web.
To test: