mushanshitiancai/vscode-paste-image

Specify image folder relative to file location?

gandalfsaxe opened this issue ยท 4 comments

Hi,

I can't quite figure out how to put all images into a subdirectory assets/ at the location of the current markdown file. All the examples seems to refer to the project root. I tried this:

"pasteImage.basePath": "${currentFileDir}/assets/"

But it still puts the images in the same folder as the markdown file and the path of all the images gets prepended with ../, such that:

![](2018-10-19-10-43-32.png)

becomes

![](../2018-10-19-10-43-32.png)

So the setting above actually just breaks the image insertions (since the file is still in same folder as the md file) instead of doing what I want. Any suggestions?

I got this working the other day by adding the following to my VS Code settings.json:

    "pasteImage.path": "${currentFileDir}/assets",
    "pasteImage.basePath": "${currentFileDir}",
    "pasteImage.forceUnixStyleSeparator": true,
    "pasteImage.

It worked great for a bit ... but then stopped working. :/ So, give it a try, but I'm not sure if I also messed it up, or if something maybe changed in the extension / my computer that made it not work.

@gandalfsaxe Hi, pasteImage.path is the path that image will save in. For example:

  1. artile path: /user/mushan/blog/a.md
  2. pasteImage.path=${currentFileDir}/assets
  3. paste, image will be saved in /user/mushan/blog/asserts, and will insert in article

@thundernixon Thank you, you suggestion is right.

Ah that works, excellent ๐Ÿ‘ I was using pasteImage.Basepath instead of pasteImage.path.

Ohh it took me awhile to find my error, but if anyone else is struggling:

  1. All I needed in the VS Code user settings JSON was "pasteImage.path": "${currentFileDir}/assets", (not the other lines)
  2. I needed to use Option Command V to paste the image, and I was forgetting the Option key