Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Use the scaled-down image for SMK thumbnails (#938)
Dhruv Bhanushalie89be335fbad
diff --git a/api/catalog/api/views/image_views.py b/api/catalog/api/views/image_views.pyindex 154f5d45a..517ed8c60 100644--- a/api/catalog/api/views/image_views.py+++ b/api/catalog/api/views/image_views.py@@ -1,4 +1,5 @@import io+import reimport structfrom django.conf import settings@@ -113,6 +114,13 @@ class ImageViewSet(MediaViewSet):if not image_url:raise get_api_exception("Could not find image.", 404)+ # Hotfix to use scaled down version of the image from SMK+ # TODO Remove when this issue is addressed:+ # TODO https://github.com/WordPress/openverse-catalog/issues/698+ if "iip.smk.dk" in image_url:+ width = settings.THUMBNAIL_WIDTH_PX+ image_url = re.sub(r"!\d+,", f"!{width},", image_url)+return super().thumbnail(image_url, request)@action(detail=True, url_path="watermark", url_name="watermark")