Skip to content
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

Support SVG images defined in metadata #68

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

holly-cummins
Copy link
Collaborator

While looking at quarkusio/quarkus#30459, @maxandersen and @gsmet asked about SVG support. I had to test SVG support, since I’m relying on the framework for image processing. By default, SVG doesn’t work, so I’ve added some extra implementation to support it.

This only covers the case where the image is set in the extension yaml. If we’re getting the image from GitHub, they have their own rules, which exclude SVG.

I followed the hints in https://stackoverflow.com/questions/53628498/gatsby-image-svg-not-found. Using a raw <img tag feels a bit odd, but
https://stackoverflow.com/questions/71665446/how-to-render-svg-files-with-gatsby-image confirms it’s a sensible thing to do. (The react plugin is solving a different problem to what we have.)

To increase the chances of the svg being rendered at the right size, I set a size explicitly on the image itself; I'm not going to be able to tamper with the viewbox of the SVG itself, but <img size should work on most browsers except maybe IE. In my testing, it displayed fine even without the size, I assume because we're usually shrinking it from larger originals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant