-
Notifications
You must be signed in to change notification settings - Fork 50
Use upstream thumbnail if available #1138
base: main
Are you sure you want to change the base?
Conversation
API Developer Docs Preview: Ready https://wordpress.github.io/openverse-api/_preview/1138 Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again. You can check the GitHub pages deployment action list to see the current status of the deployments. |
Based on the medium urgency of this PR, the following reviewers are being gently reminded to review this PR: @obulat Excluding weekend1 days, this PR was updated 4 day(s) ago. PRs labelled with medium urgency are expected to be reviewed within 4 weekday(s)2. @krysal, if this PR is not ready for a review, please draft it to prevent reviewers from getting further unnecessary pings. Footnotes |
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.
LGTM. Nice simple change. Hopefully someone else has testing suggestions 😄
@@ -108,17 +107,10 @@ def oembed(self, request, *_, **__): | |||
def thumbnail(self, request, *_, **__): | |||
image = self.get_object() | |||
|
|||
image_url = image.url | |||
image_url = image.thumbnail or image.url |
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.
I am not sure we should use thumbnail
for all providers just yet. Do we know what kind of thumbnail URLs we have in the catalog database? I'm afraid that because we sometimes used whatever the providers gave as thumbnail
, the dimensions and the quality can vary greatly, and we might end up with low-quality thumbnails for some items.
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.
Sorry for the long delay in review, @krysal. Can we use thumbnail
fallback only for the providers that we know have thumbnails of acceptable quality? @AetherUnbound, do you have any intuition/knowledge about the quality of thumbnails in the catalog database?
Fixes
Fixes WordPress/openverse#675 by @stacimc
Description
Sends the URL of the upstream thumbnail to Photon if available, so we can get the thumbnail faster and prevent timing out in some extreme cases.
The code change itself is pretty simple but I'm having a hard time testing this automatically so any help in this regard is welcome here. Maybe someone can observe something I'm missing or come up with a better idea.
Testing Instructions
To manually test this you can pick any image from the database that has a thumbnail (applies for Flickr and Stocksnap) and compare the result of the
http://localhost:50280/v1/images/<identifier>/thumb/
endpoint to itsurl
. Observe the difference in sizes. On themain
branch, you will get the same image.Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin