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

Option for file location #82

Open
Archie-2021 opened this issue Dec 19, 2023 · 7 comments
Open

Option for file location #82

Archie-2021 opened this issue Dec 19, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@Archie-2021
Copy link

Is it possible to not move the renamed attachment automatically? Or at least add an option for it. There are so many plugins I have dealing with different aspects of attachment and pasting and all they want to move the file by their own preference. Adding such an option would make this plugin more compatiable.

Thanks

@Archie-2021 Archie-2021 added the enhancement New feature or request label Dec 19, 2023
@Xtremefaith
Copy link

+1
I need this so much. Currently I'm trying to use Calendar/{{DATE:YYYY}}/Screenshots/{{fileName}} and it appears to work as expected but then it just saves the file name as the entire path and removes the "/" from the string.
image

@WadoodAbdul
Copy link

+1

I keep all the images in a separate assets folder and it would be great if this plugin also places images there automatically.

This is how I'm doing it currently -

  1. Specify the assets folder path in the image name pattern option in the plugin
  2. Update the code for the obsidian plugin
    1. this is the file - your_vault/.obsidian/plugins/obsidian-paste-image-rename/main.js
    2. Search for var filenameNotAllowedChars = /[^\p{L}0-9~`!@$&*()\-_=+{};'",<.>? ]/ug;
    3. Replace it with var filenameNotAllowedChars = /[^\p{L}0-9~`!@$&*()\-_=+{};'",<.>?/ ]/ug; (forward slash is added after '?')
  3. Reload obsidian (restart)

And you are done!

@Archie-2021
Copy link
Author

+1

I keep all the images in a separate assets folder and it would be great if this plugin also places images there automatically.

This is how I'm doing it currently -

  1. Specify the assets folder path in the image name pattern option in the plugin

  2. Update the code for the obsidian plugin

    1. this is the file - your_vault/.obsidian/plugins/obsidian-paste-image-rename/main.js
    2. Search for var filenameNotAllowedChars = /[^\p{L}0-9~`!@$&*()\-_=+{};'",<.>? ]/ug;
    3. Replace it with var filenameNotAllowedChars = /[^\p{L}0-9~`!@$&*()\-_=+{};'",<.>?/ ]/ug; (forward slash is added after '?')
  3. Reload obsidian (restart)

And you are done!

Interesting, so this would make the file in root of your vault by removing / in path, right?

@WadoodAbdul
Copy link

WadoodAbdul commented May 13, 2024

@Archie-2021 the current behavior I experienced was that the plugin moves the image file to root by default.

However, my requirement was to place it in a separate folder of my choice. I had added this folder location in the {{image name patter}} option in the plugin, hoping that I can just add image-name after the pattern and get my desired behaviour.
But that wasn't working as '/' gets replaced from the image name(including the image name pattern).

Making the changes #82 (comment) would ensure that '/' does not get filtered from the image-name and you get to store the image file in a location of your choice.

@Archie-2021
Copy link
Author

gg

@Archie-2021 the current behavior I experienced was that the plugin moves the image file to root by default.

However, my requirement was to place it in a separate folder of my choice. I had added this folder location in the {{image name patter}} option in the plugin, hoping that I can just add image-name after the pattern and get my desired behaviour. But that wasn't working as '/' gets replaced from the image name(including the image name pattern).

Making the changes #82 (comment) would ensure that '/' does not get filtered from the image-name and you get to store the image file in a location of your choice.

I see, it is a good solution indead. Would try to implement it on my vault too to see how it works.

@dalibord
Copy link

dalibord commented Nov 6, 2024

+1
Add an option for moving the pasted file into the same folder as the original file, at least

@boardtc
Copy link

boardtc commented Nov 25, 2024

This is a glaring omission, in my opinion. The directory should automatically default to the _resources of the folder the notes are being saved in. My workaround for now is to rename the image. Then, go to the root folder, right-click, and move the image. This is fine to do on Windows, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants