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

optionally embedd images as base64 #69

Open
alexanderadam opened this issue Sep 7, 2020 · 8 comments · Fixed by #73
Open

optionally embedd images as base64 #69

alexanderadam opened this issue Sep 7, 2020 · 8 comments · Fixed by #73
Assignees

Comments

@alexanderadam
Copy link

alexanderadam commented Sep 7, 2020

It's possible to embed images via data URLs in base64. For example

![Image](data:image/png;base64,SOMEBASE64STRING)

It would be nice if copy-selection-as-markdown would support this functionality as well.
This way it would be easier to have a full backup of an article that might be deleted later on, including it's resources.

PS: Thank you for this extension 🙏
PPS: There are also browser extensions like img2base64, that allow to copy an image as base64 directly. Maybe it would be possible to take that logic from there?

@alexanderadam
Copy link
Author

alexanderadam commented Oct 1, 2020

There's also a tool for backing up Medium articles called medup that's doing this.
What I like about the approach in medup is, that the images are only inlined at the end and there are only references to them within the regular text flow.

@0x6b
Copy link
Owner

0x6b commented Oct 3, 2020

@alexanderadam: Thanks a lot for your suggestion! I don't have your use case but interesting enhancement. challenge accepted!

@0x6b
Copy link
Owner

0x6b commented Oct 9, 2020

Will update this issue after release.

@0x6b
Copy link
Owner

0x6b commented Oct 9, 2020

@alexanderadam: Just released v0.20.4 which contains this feature. Grub your update and let me know if you found any issue. Thanks!

@0x6b
Copy link
Owner

0x6b commented Oct 9, 2020

Check Embed imgs (.gif, .jpg, .jpeg, .png, and .webp) as base64 text as possible at Advanced setting to enable the feature. It requires additional permission to access referenced images.

@alexanderadam
Copy link
Author

alexanderadam commented Oct 9, 2020

@0x6b, Thank you so much for working on this. 🙌
Unfortunately it didn't work properly when I just tested this.
I marked your avatar here on this issue page and I got a reference but it wasn't base64 encoded.

It looks like this:

[![@0x6b][img1]](https://github.com/0x6b) [ 0x6b](https://github.com/0x6b)

[img1]: https://avatars0.githubusercontent.com/u/679719?s=40&v=4

EDIT: Maybe it's a permission thing because it's working perfectly on other sites!
I accepted the permission to access everything but it's not appearing at the listed permissions (only Input data to the clipboard is listed.):

Permissions of copy-selection-as-markdown

@0x6b
Copy link
Owner

0x6b commented Oct 9, 2020

Maybe I somehow misunderstand the optional permission concept. I also see permission error in the console like:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://github.githubassets.com/images/spinners/octocat-spinner-32.gif. (Reason: CORS header ‘Origin’ cannot be added).

Will work on this again. Thanks for testing!

EDIT: Easiest solution is to add <all_urls> permission request by default, but it's too open for advanced options.

@0x6b 0x6b reopened this Oct 9, 2020
@alexanderadam
Copy link
Author

Easiest solution is to add <all_urls> permission request by default, but it's too open for advanced options.

I absolutely agree and I value your concerns in this regards. 👍
More people should focus which permissions their extension or app is using.

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

Successfully merging a pull request may close this issue.

2 participants