Automatic image and attachment management (note-level attachment management)

I’d request to add feature to automatically manage attachment / images similar to OneNote or others :

  1. Attachment should be able (or had option at least) to be “attached” to specified notes instead of filled in common folders when being added as link or copied to note. (Plugin “Custom Attachment Location” works okay on new attachment but I believe a native solution would works more smooth and reliable)

  2. When attachment reference / links being removed from notes, it should have capability to remove the attachment automatically to avoid orphan attachments / images.

Scenario for 1 and 2: I work mainly on a daily note to collect daily meeting / discussion / note with many images and attachments. When I review the daily note and want to digest and re-allocate the notes to other specified notes, I want to minimize the efforts to manually re-allocate the images and attachment files one-by-one to move together with the individual notes and delete them in the attachment folder associated with original note.

  1. Provide capability to hidden certain folders (i.e., attachment folder) so that explorer can show more notes for easy note access.
14 Likes

I’m a great fan of obsidian, but I believe that this is a big shortcoming which drives me mental when moving notes around

Definitely a +1 from me

Right. I really wish this feature was made. It’s stressful because of the management of attachments such as images, audio, and pdf. When you delete a document, make sure that the attached files are also deleted. If you clip and paste from the Internet, make sure that the image is also saved on the hard disk.

1 Like

I have the same problem with attachments, and my solution is to use folder notes. When I need to attach a file to a note I make it into a folder note and move the attachment in the folder. This works well for me. The only complication is when using dataview to query notes.

I agree with the previous post. My vault is quite disorganized, with attachments scattered in incorrect folders and some that are no longer associated with any notes.

It would be great if there were a feature that users could enable or disable as needed.

Each note could be structured as a folder containing one Markdown file and all of its attachments. This approach would maintain compatibility with future updates, other tools, and remain GitHub-friendly, for example.

Like explained here: New "default location" behavior for attachments/images: Automatically convert the note's .md into a container-folder itself that holds all embeds and cleverly hide it throughout the UI by treating it as a regular note

Important introduction

When designing a system and its UI/IX, one can have 2 different approaches/views:

  1. Technology-centric (process-oriented)
  2. User-centric, functionality-centric (result-oriented)

It’s about who needs to adapt to which way. In the former, humans must learn and adapt to how computers operate. In the latter, the human needs and way of doing/thinking are on top, and the UI/UX/software does whatever is needed to translate this human way into the computer-understandable form.

Examples:
Programming languages: assembler vs. higher-level languages like Ruby.
Doors: a block of wood to barricade the medieval door vs. button in the app, that sends a signal and that automatically opens the door.
Cars: manual shift vs. automatic shift.

The first approach has its place, but generally speaking, the second one is better, especially in consumer products. It is the approach that will lead to the product being easier to use, more appealing, and more popular.

People want to do FunctionX as effortlessly as possible (with just enough control, not too much and not too little) with software parts handling all the necessary steps, not doing all of the technical steps manually. At the end of the day people want function and don’t care how it is done underneath.

  • That’s why one can drag-and-drop files and directories from one file manager window to another, even though that is a drastic omission of actual reality (especially with moving recursive directories located on different disks (or even one of them on the internet drive)).
  • That’s why you can copy-paste files from one folder to another even though copying files has nothing to do with the system clipboard.
  • The mere fact that the term “folder” is used instead of the “directory”. Just to make it more understandable to humans even if it makes it not correct.

And thankfully Obsidian developers understand that. Eg. that’s the reason why Obsidian moved from Edit/View modes to one WYSIWYG mode. This is a good development (as well as leaving more control for people who need it).

And here we finally come to my issues and suggestions.

From the same point of view, Obsidian is still lacking in some areas. Namely:

  1. deleting notes
  2. moving notes

The core issue is that people (Obsidian users) care less about the physical (electrical) files and the combination of such files which constitutes “the note (abstract)”. They care and operate on the level of the abstract “note” (which included both the physical note file as well as all the images and attachments).

Use case1 - Deleting notes

Sometimes I want to delete only one note file. But more often than not, when I want to delete a note, I want to delete an abstract “note” - I want to remove it together with all the images/attachments (that are not used elsewhere).

When I copy&paste an article to create a note, I do it with images (Local Images plugin is helpful). I view text+images+attachments as one thing. And when I want to delete the note, I also want to delete the whole abstract “note” (note + attachments).

This is exactly the same even if I wrote the note manually, combined information from multiple sources and added illustrations, but then decided that I don’t need it anymore.

Optimally there should be 3 options (2 new):

  1. It’s good to leave the current “Delete current note file only” as an option.
  2. Add “Delete current note with unlinked attachments”. This should be the default hotkey action.
  3. Add “Delete current note including all attachments, even if linked from elsewhere”.

Use case2 - Moving notes

SettingsFiles & Links

  • Default location for new attachments = In subfolder under current folder
  • Subfolder name = “attachments”

Similarly, when I want to move a note, I want to move the abstract “note” and not only the physical note file without its attachments.

Proposed solution

The solution to the case of “Deleting notes” is straightforward: delete attachments that are linked only from the note currently under deletion.

The “Moving notes” is a bit more complicated:

  1. Sometimes the files don’t need to be moved (depending on the Default location for new attachments setting and whether the attachment is linked elsewhere.
  2. if the person changes mentioned settings somehow.

Basically should check if the current attachment path is legal and if it isn’t, move the attachment to the new primary attachment path. The current attachment path can be legal even if the note is moved, because:

  1. maybe the attachment is linked elsewhere and it is located in another note’s folder/subfolder
  2. maybe the settings are such that all attachments are stored in one common folder (vault’s or a specific). If settings are not changed, the attachment doesn’t need to be moved anywhere.

If speaking in a form of pseudocode:

function isAttachmentPathLegal (notePath, attachmentPath) {
    (...)
    return result;
}

function returnPrimaryAttachmentPath (notePath) {
    (...)
    return result;
}

function moveAttachment (oldAttachmentPath, attachmentName, newAttachmentPath) {
    (...)
    return result;
}

function syncAttachmentPath (oldAttachmentPath, attachmentName, newNotePath) {
    let primaryAttachmentPath = returnPrimaryAttachmentPath(newNotePath);
    if (primaryPath == attachmentPath){
          moveAttachment(oldAttachmentPath, attachmentName, primaryAttachmentPath);
    }
}

----------------------------------------------------------------------------

if (isAttachmentPathLegal(newNotePath, currentAttachmentPath) == false) {
    syncAttachmentPath(currentAttachmentPath, currentAttachmentName, newNotePath)
} 
else // isAttachmentPathLegal(newNotePath, currentAttachmentPath) == true
{
    // leaveAttachmentBe();
}

I hope this was more helpful than not (I apologize if there are bugs :slight_smile: ).

The code takes into account the possibility of changing the Default location for new attachments and/or Subfolder name settings (I don’t know what happens to the attachment files in case the settings are changed; if there is already a sync process that moves files to their new valid locations) in which case the previously correct path becomes invalid.

Optimally there should be 2 options (1 new):

  1. It’s good to leave the current “Move current note file only” as an option.
  2. Add “Move current note including attachments”. This should be the default hotkey action.

Additional considerations

  • The lack of functionality of “deleting notes together with attachments” is disappointing, but is still understandable and wanting it feels like a valid and important, but feature request nevertheless.
  • But not having the “Move current note incl. attachments” (as default) feels like a proper bug, at least on the emotional and conceptual level. “What do you mean that I told Obsidian to move the note, but it did not move my whole (abstract concept of the) note?! This is a bug and must be fixed”. This is an absolute necessity for somebody like me, who uses folders/subfolders a lot and actively moves notes around. I was considering filling 2 different reports (deleting = feature request; moving = bug), but then decided against it, as combining the issues under one umbrella felt more fitting at the time of the writing. Tell me if I should create a new bug report instead. As you can see from my whole note, I understand that the situation is not trivial and implementing it is not straightforward. But I still hope you empathize with the needs of us the folder-centric users and make this feature request a priority.
  • Should something be done about the attachments after cloning/copying the note?.. I didn’t have time to think about this deeply.
4 Likes

+1 on this

Would love to see this feature as well.

Digital storage tends to clutter up easily.

Being able to rely on any system requires that it be cleaned up every once in a while to keep it current.

1 Like

Currently (v.0.11.0) in the options, if I set “Default location for new attachments” to “In subfolder under current folder” and “Subfolder name” to “attachments”, any note attachments (i.e. figures, PDFs …) will be automatically stored at “attachments” folder at the same level where the note is created.

However, at most of the time, I will first start my note at some location (i.e. say inbox) and later on moved to some other better categorized path. Even the note can be moved easily, the attachments are not.

Is it possible for the tool to automatically move the attachments any time the note itself is moved? So that I can always easily locate / maintain the attachments and note in the Finder.

For example, if my note name AAA, the attachments are always at AAA_attachments folder at same level. If I move the note from the sidebar, the attachments folder moves automatically in background.

17 Likes

I am using this plugin for that purpose, and it is very helpful:

2 Likes

OP’s question seems (to me at least) to be more about moving some but not all notes from a folder and taking their attachments with them.

The problem I see with this is what happens if you have Note A and Note B both referencing an image in the local attachments folder, and you move Note A but leave Note B in place. Do you leave the image in the local attachments folder and update Note A point to the image in the “old” location? Or do you move the image and then update Note B to point to the image in the “new” location? Or do you copy the image to both locations?

Then there’s the issue of how are existing user workflows handled? For example, my workflow doesn’t need this capability at all, because I either add images to a global folder or to a source-specific folder, so the images will always be attached to their source which is itself in the enclosing folder. So adding this would require either (a) adding a configuration item that increases complexity or (b) changing existing behavior which breaks my own workflow.

I suspect adding something like this opens the door to a lot of edge case complexity and it is probably preferable to keep Obsidian simple, especially since there’s currently a straightforward (but admittedly mildly frustrating for the individual who wants this) manual workaround.

But that’s just my thought.

2 Likes

Yeah, I think there is a general problem for markdown and images and other attachments that is not limited to this app. Html can handle this by saving all in one file but on the other hand html is not as minimal as markdown. Maybe a mid-way solution for images could be possible, as images should be considered minimal in 2021.

@ davecan
You mentioned the case that “Note A and Note B both reference an image in the local attachments folder”, and I think if every note has option to have its dedicated “*_attachments” folder and automatically managed by the note tool, this problem should be solved. Common reference might save some disk space but I don’t think this can be a big deal for nowadays PC hard disk size.

1 Like

if every note has option to have its dedicated “*_attachments” folder

I would uncheck this option with extreme prejudice lol. It simply does not fit at all in my workflow and I’ve never heard of it in any other note tool.

That said, its up to the devs and the community whether adding an option for this is warranted. I suppose it could become just another dropdown in the Default location for new attachments setting.

Out of curiosity, what is your real world use case for this feature?

Yes, I’d suggest this becomes another drop down option in the “Default location for new attachments” as you mentioned.

The use case can be as below:

  • Note can be started quickly at one place but later on be moved to some other places during its life span
  • A lot of screenshot and file attachments can be added to note during updates of the note in its life span
  • If attachments go with note, these attachments are always “attached” to the note no matter how I move them and I can easily locate all of them in the Finder / File Explorer then zipped to share with others who don’t have Obsidian or for other purpose like backup
  • It will also be easier to remove some notes along with attachments quickly in the Finder / File Explorer without checking reference relationships in the Obsidian tool
  • Also it naturally avoids large amount of orphan attachments (i.e. quick screenshots, PDFs or other files) when notes are deleted
10 Likes

I think this would go well with this suggestion, if it gets implemented.

1 Like

Yes, I also think so as long as the attachment folder is kept sync with note (i.e. rename, move, copy …) automatically.

I think this is showing a difference in the overarching strategy behind how different user personas use Obsidian.

@WhiteNoise You may already have these personas developed but if not there seem to be at least two user personas at play here: one that wants a more hierarchical approach for knowledge/reference management, and one that wants a more fluid note-focused approach for Zettelkasten-style knowledge development with attachments relatively decoupled from notes. (I’m in the latter, but do also store some reference/cheatsheet type info in the same vault, but would not want the described function to become a global default for all of my notes)

I may be misunderstanding the persona here, and I’m sure there’s other personas as well.

This could be an interesting feature for certain personas as long as it doesn’t unduly disrupt workflows for the others.

But I do think it could be worthwhile for Obsidian to provide some guidance up front on the overall strategies that each option supports or inhibits. And perhaps some guidance on common settings / plugins / themes to use for users who are switching from Noteplan, Bear, Roam, etc. to make the experience feel more like their prior app.

@greatqs

This can be done by the plugin
consistent-attachments-and-links

But if you use obsidian Sync now it does not work correctly with it - Obsidian Sync. Spontaneous deletion of pictures - #15 by friendlmickle.

I make issue - Обновление кеша ссылки - конфликтует с работой obsidian Sync · Issue #8 · dy-sh/obsidian-consistent-attachments-and-links · GitHub and hope the developer will fix this soon. I like the plugin very much!

1 Like

@friendlmickle Hi, I just checked plugin github link but it seems there is no fix on the sync issue as you mentioned. Do you know whether this is currently any solution to have this attachment folder renaming feature while keeping compatible to native sync?