WordPress / openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
https://openverse.org
MIT License
244 stars 195 forks source link

SVG thumbnails do not work #2397

Closed zackkrida closed 1 year ago

zackkrida commented 1 year ago

Problem

Currently SVG thumbnails do not work as they're not supported by our thumbnail service provider Photon. This feels like poor service to our users. How could we make sure they can view SVG thumbnails?

Description

On the frontend we fallback to the full direct image url when a thumbnail isn't available. Could we directly serve the SVGs through our /thumb endpoints? IS there another approach?

Additionally, on any search with the extension=svg query param set, all thumbnails will fail with 415 errors.

Alternatives

Currently < 2% of our thumbnails are 415 Unsupported Media type errors, so this does not impact many thumbnails and therefore, users.

Additional context

roytanck commented 1 year ago

Could it be that this does not just happen with SVGs? The source image at https://api.openverse.engineering/v1/images/e1f5bd15-2ce1-4323-9088-684984f2d849/thumb/ appears to be in the TIFF format, and returns a 415 for me.

Unlike SVG, returning an unaltered TIFF is probably not an option (heavy and not supported by browsers).

obulat commented 1 year ago

Yes, @roytanck, tiff is another file format that is not currently handled well by the /thumb endpoint. We use photon to thumbnail original images and to cache them. Unfortunately, it does not support tiff files, so we will need to create a separate solution. For now, as you say, we are returning "heavy and not supported by browsers" unaltered TIFF.