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

[#1059] Added support for SVG logos #532

Merged
merged 2 commits into from
Mar 15, 2023
Merged

Conversation

Bartvaderkin
Copy link
Contributor

@Bartvaderkin Bartvaderkin commented Mar 14, 2023

Note I had to update some dependencies to get SVG support in django-filer

@Bartvaderkin Bartvaderkin marked this pull request as ready for review March 14, 2023 11:40
@Bartvaderkin
Copy link
Contributor Author

@jiromaykin I'm not 100% sure if the CSS changes are OK, as you explicitly added those height:auto; 's, but it doesn't work if I keep them.

Note I also needed to set a height-attribute on the SVG's image element for it to show up, but then that would break the non-blurry-images for regular pixel images so I made it adaptive.

I got some SVG's from here: https://www.cityofenschede.com/en/brand (particularly the wide logo)

@jiromaykin
Copy link
Contributor

[...]'m not 100% sure if the CSS changes are OK, as you explicitly added those height:auto; 's, but it doesn't work if I keep them.

OK @Bartvaderkin - i needed those heights for mobile, in order to not prevent the images stretch/shrink really weirdly - but i will check to see what happens with SVG's and other images. And... maybe different thing happens if the user uploads SVG's that have an inline style?

@@ -1,13 +1,9 @@
.logo {
&__image {
max-width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems completely fine actually - I've done some really weird testing with strange SVG's and the only SVG's that do not behave well are the ones with inline-styling and without an explicit viewbox - so: if users upload correct and valid SVG's then the styling behaves well (something to note for ourselves in case future users report problems with SVG).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh yes invalid or weird SVG's are a complication. The SVG used should at least look normal in a browser/viewer without margins (viewbox and transforms etc)

@alextreme alextreme merged commit 4bb763f into develop Mar 15, 2023
@alextreme alextreme deleted the feature/1059-svg-upload branch March 15, 2023 10:17
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.

4 participants