-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Embed block: use preview html for flickr embed previews in editor #40187
Embed block: use preview html for flickr embed previews in editor #40187
Conversation
Despite the above initial fix implementation, I wanted to ask people reviewing this whether they can justify the need for I tried to look for other examples than
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @mashikag!
I took a look here and I was wondering if it would be simpler to just change this line of code and give priority to the full image. Would that work?
Yes, it does work. However would that not break any other It would make even more sense to me to always use
Or even rename the
But it just makes me question what was the purpose for this function when it was written, which embedded service (live example) required this handling? Would you have any insight to this @ntsekouras ? |
I'm not sure how this could break things. It was actually used before in code and if the
I'm not really sure about the reasoning of the original coding of this and I'm not sure if your suggested change will affect other embedded previews. That's why I suggested the above change of priority - it was used before and gives us the wanted result. |
Yes, it was used but only if the On the other hand, I could just leave a note beside the change, linking to the issue, in case it will break something as per above. |
d3ee85b
to
5090916
Compare
…embeds This commit is fixing an issue where flickr embeds display pixelated preview images in the block editor. The issue was that flickr embed (variation of embed block) preview used thumbnail image, over better quality preview options, such as full image url. The thumbnail image is low resolution and 1:1 aspect ratio (often cropped out) version of the original image. Then the preview is stretched to 100% width of the parent element. This resulted in low resolution image being stretched out beyond its width and height. Hence it appeared pixelated. The issue is fixed by using full image `url`, over `thumbnail_url`, when generating html for `photo` type embed previews.
5090916
to
68ad17f
Compare
Hey @ntsekouras ! 👋 Could you have a look at the PR again, please? 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @mashikag! Let's try this.
Thanks @ntsekouras ! 🙇 BTW just letting you know because I am not sure if it is obvious or not, but I do not have merge rights here. |
I knew that, yes 😄 . I was waiting for the CI to go 🟢 . Thanks again! |
What?
This commit is fixing an issue where flickr embeds are displayed with low quality images in the block editor.
The issue was reported here.
Why?
The issue was that thumbnail image (low resolution image) was used for flickr's embed previews. On top of that the preview was stretched to 100% width of the parent element, which most of the time meant more than width of the preview's thumbnail image. This resulted in flickr embed previews appear "pixelated" in the editor.
Flickr oEmbed previews returned by their oEmbed API are marked as 'photo' types. According to our source code we prefer to use the thumbnail url, over preview's html when embed's type is 'photo'.
How?
I fixed this by introducing new block attribute of 'preferHtml' which, when set to
true
, forces the use of preview's html even when an embed is of 'photo' type.Testing Instructions
https://flic.kr/p/oj7o7q
Screenshots or screencast
Before fix
After fix