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

Paste Image from clipboard #429

Open
3 tasks
cropse opened this issue Apr 6, 2017 · 4 comments
Open
3 tasks

Paste Image from clipboard #429

cropse opened this issue Apr 6, 2017 · 4 comments

Comments

@cropse
Copy link

cropse commented Apr 6, 2017

Hi:
It might be a convenience feature when user wants to paste images in Markdown immediately, with Pillow package would be feasible?

There is few modify I expect:

  • pillow package include
  • image folder/path in user setting
  • key binding for paste image

If it is a great feature good to have, I can take time to implement it, How about that?

@felixhao28
Copy link
Contributor

@cropse This is an interesting idea, definitely worth a try. I can think of some challenges:

  1. How well does ST supports customizing pasting image event?
  2. How to handle different image format?
  3. There are two ways (AFAIK) of copying images: one is copying pixels (e.g. screenshot), another one is copying image file.
  4. Is your solution portable across OSX, Linux, Win?
  5. Where do you put image files? In actual files or blobs? If former, is it customizable for each project? If latter, will it affect editing experience?
  6. Markdown is intended to generate HTML. All images should ultimately be loaded by web browser through URL. How do you map file system path to web path?

@fotoflo
Copy link

fotoflo commented Dec 22, 2017

It would be great if i could oauth into github and then be uploading them into https://user-images.githubusercontent.com/, then the image URL can populate automagically.... like this:

image

@felixhao28 @cropse

@felixhao28
Copy link
Contributor

Uploading to Github (or any public web content storage) is one way of serving the image. This also poses a risk that web content is loaded from different servers. CORS is enabled for images but you will expect users to have direct and stable network access to Github, which might be a problem for users behind firewalls or on internal networks. More often, I see markdown writers serve images locally (e.g. Gitlab, wiki, blog).

If we are going to implement this feature. We can start from mapping local file path to relative URI. There is an open PR #486 that handles local file mapping that we can leverage.

@bao7uo
Copy link

bao7uo commented Jan 22, 2018

There is this plugin which I cannot get to work, but it I guess it would be a starting point.
https://github.com/robinchenyu/imagepaste
I think they have the right idea, save in a subfolder as PNG and insert the relative path ./subfolder/pasteimage.png at the point of the cursor. By the way, options about what to name the image might be useful. For example, prefix of current document's file name, current date/time, or incremental number etc.

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

No branches or pull requests

4 participants