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

b64: Add svg to list of supported extensions #1619

Merged
merged 1 commit into from
Feb 25, 2022
Merged

b64: Add svg to list of supported extensions #1619

merged 1 commit into from
Feb 25, 2022

Conversation

mtdcr
Copy link
Contributor

@mtdcr mtdcr commented Feb 24, 2022

Tested and works fine.

@gir-bot gir-bot added S: needs-review Needs to be reviewed and/or approved. C: source Related to source code. labels Feb 24, 2022
@facelessuser
Copy link
Owner

It's not really the ideal way to embed SVG, but I guess it does work. You'd almost be better off embedding the SVG raw as it would be smaller in size than being converted to base64. There are other ways to minimize SVG and embed them.

@facelessuser
Copy link
Owner

We'd probably need tests for this if we were to accept it, but I'm honestly not sure how I feel about embedding SVG with Base64 as it just increases the size even more. Especially when you don't need to base64 SVG.

@mtdcr
Copy link
Contributor Author

mtdcr commented Feb 24, 2022

Of course size increases with base64, but it does increase for png, too. It's surprising for a user if some formats get inlined and others don't. There's no other plugin that inlines svg img tags currently, AFAICS. I don't have control over the types of images used in my application or how they get embedded. I'd just like to inline them.

There already are tests for png covering the blob-to-base64 aspect, and none for the other supported file types. I don't expect any difference at all. Which aspect would you like to get covered?

@mtdcr
Copy link
Contributor Author

mtdcr commented Feb 24, 2022

See also https://stackoverflow.com/a/21626701 for funny problems arising when trying to avoid base64-encoding svg in data uris.

@facelessuser
Copy link
Owner

but it does increase for png, too.

Yeah, but you can't embed a PNG directly without base64, that's why it's a fine option. For this reason, I considered a general-purpose extension to replace them, a general-purpose image embedding extension: #862.

With that said, less desirable doesn't mean undesirable 🤷🏻.

There already are tests for png covering the blob-to-base64 aspect, and none for the other supported file types. I don't expect any difference at all. Which aspect would you like to get covered?

I guess that's a fair argument 🙂.

@facelessuser
Copy link
Owner

I'll probably let it go in. Even if we do this better in a future extension, there isn't really a reason to not allow it here.

@facelessuser
Copy link
Owner

@gir-bot lgtm

@gir-bot gir-bot added S: approved The pull request is ready to be merged. and removed S: needs-review Needs to be reviewed and/or approved. labels Feb 25, 2022
@facelessuser facelessuser merged commit bbe726b into facelessuser:main Feb 25, 2022
@mtdcr mtdcr deleted the b64-svg branch March 5, 2022 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: source Related to source code. S: approved The pull request is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants