obsidian-attachment-name-formatting
obsidian-attachment-name-formatting copied to clipboard
[Question] circular problem: Two notes use the same ONE image
For example:
A.md uses "A Image 1.jpg" yesterday, B.md uses "A Image 1.jpg" today, the plugin will changed this image to "B Image 1.jpg". The image name in A.md will be changed accordingly.
Is there any better solution for this situation?
Hi, thanks for using this plugin! This is a known issue and written in Readme. I have an idea about changing the display name of the attachment in the note. But the idea of the plugin is to make every attachment's name formatted with the note name in the filesystem. Then the attachment name is hard to relate to two notes' name. So I actually don't have a better idea at the moment.
Do you have some good suggestions?
Thanks for your rapid reply. My roughly idea:
A.md uses "A Image 1.jpg" yesterday, B.md uses "A Image 1.jpg" today
If you detect there's another note uses the image, do not change the name, but copy this image and named as "B Image 1.jpg".
There's an settings option to specify the conflicted situation, Rename or Copy or don't change:
- Rename to new one: the default behavior (plugin uses this strategy currently)
- Copy: copy the original "A Image 1.jpg" to "B Image 1.jpg". We'll waste the disk space but maintain the naming consistency.
- Don't change: B.md uses the original "A Image 1.jpg"
Good point! It's a good solution I would say. Thanks for your suggestion! I'll put it in this plugin.
I'll be relieved to see this solution implemented. Normally I want all images renamed to match their notes, but now I have a place-holder image I need to refer to sometimes, without creating a new copy each time. This would solve that with the third option, I think.
Thank you for your extremely helpful plugin!
the same question for me, I think there is one easy way to solve it. Maybe add an option to only change the name once when the first time insert.
Is this issue solved?
Not yet, plan to start work on this recently.
JYC333, fist Orr, thanks for a great and simple plug-in
I have an idea that could resolve this issue.
How about activating an option that would allow the user to specify a custom file naming format, ie my preference would be to name attachments by their time stamp rather than associated with their note name, since I already save them in a folder associated with the note
so if I could specify something like YYYYMMDDhhmmss image-nn that would be great and would resolve the issue above for me. I can then always go toggle the option to include the note name in the attachment if I want to name attachments associated with the name.
Make sense?
Further to the above, would be great if some of the features of “Custom attachment location” plug-in could be implemented in this plug-in, since that one doesn’t work for iOS.
iOS obsidian have an issue in that when taking a picture to attach to a note, the attachment is always just named “image.jpg”. That’s no good since the vault starts filling up with multiple attachments of the same name over time.
This attachment solves that issue, except for the issue in this thread. The solution offered by the plug-in “Custom attachment location” solves ut elegantly, except that plug-in is note compatible with iOS or no longer under development. 🫤
anyway, thanks for considering implementing some of this!
JYC333, fist Orr, thanks for a great and simple plug-in
I have an idea that could resolve this issue.
How about activating an option that would allow the user to specify a custom file naming format, ie my preference would be to name attachments by their time stamp rather than associated with their note name, since I already save them in a folder associated with the note
so if I could specify something like YYYYMMDDhhmmss image-nn that would be great and would resolve the issue above for me. I can then always go toggle the option to include the note name in the attachment if I want to name attachments associated with the name.
Make sense?
I add a setting to add time stamp after the index number in 1.9.8, I'll add the option to not include the note name later. But I don't think this can solve this issue, one attachment used in two notes.
I'm not sure about your second comments, there is an official setting to change the attachment location right? And when the attachment is renamed, it will move to that location. I also add something that to allow you to specify the subfolder of the attachment you want to put in, hope this can help your situation.
Thanks for your rapid reply. My roughly idea:
A.md uses "A Image 1.jpg" yesterday, B.md uses "A Image 1.jpg" today
If you detect there's another note uses the image, do not change the name, but copy this image and named as "B Image 1.jpg".
There's an settings option to specify the conflicted situation, Rename or Copy or don't change:
- Rename to new one: the default behavior (plugin uses this strategy currently)
- Copy: copy the original "A Image 1.jpg" to "B Image 1.jpg". We'll waste the disk space but maintain the naming consistency.
- Don't change: B.md uses the original "A Image 1.jpg"
Hi everyone, thanks for using this plugin and wait for this for a quite long time! Sorry for not working on this such a long time...
I have explored a bit with symlink, but it turns out that when I rename the symlink, the original file will be renamed also. So I finally back to this suggestion.
So now there are three options like said above, and released in version 2.0.0. I will keep this issue open for a while (maybe a year again hhh) to see whether people can have any better suggestions on this issue.
Anyway, thanks for waiting! And welcome to report the bugs!
I just about had a heart attack as some of my photos got renamed to be the title of file B. I don't have very many important photos in my vault, a lot should probable be removed, but my journal does. I just saw the files get renamed and freaked out, went to Dropbox to find the file name in the history to rename them back. When I did that I searched for the files in my journal I saw that they were now broken because the links were also renamed in old journal posts. I fixed a file, but I have no idea what else broke. Altimetry it is my fault for renaming them within Dropbox instead of obsidian, as if done in obsidian the links would have been updated. But now I am going to have to search my journal for "![[" to find images, then go back to Dropbox to see that file's version history to see what the link was originally called then change it back. I forgot this plugin renamed files and panicked.