3

I am trying to upload an SVG logo for my Magento website, but it is not allowing me to upload an SVG file. It says that it is an unsupported file. Any idea how to resolve this?

Based on internet searches, it looks like Magento has disabled SVG support for security reasons. Is there any way I can re-enable it?

Thanks a lot

1 Answer 1

2

Your best bet is going to be editing your theme templates to include your svg image direclty. I think it would too much trouble to change this setting, and if it's a security concern by core developers, maybe it's best not to.*

To override theme file, add this file to your current theme:

<Vendor>/<Theme>/Magento_Theme/templates/html/header/logo.phtml

Copy the contents from the same file located in the Magento_Theme module, and replace the image path your svg file.


*I was curious why svg wasn't allowed. Apparently the reasoning was this:

A Magento administrator with limited privileges can add new SVG images that contain injected code.

source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.