...part, and then drag-and-drop the correct one. It will naturally generate a new id for the image and the linked element. But since the erased text was the only reference to the wrong image on any note across all Joplin, does it mean that the wrongly attached image at the beginning, which is now an orphan, is also deleted from the resources folder?
Some do get deleted, some don't. There are three that never seem to go away and while orphans, they do seem to collect a ton of siblings. Files "AllClients.png" and "SubNotebooks.png" and "WebClipper.png" collect like cockroaches. The notebooks that caused them to be created (on mobiles that sync for the first time even after their "Welcome" notebook has been deleted) do not exist but these three files are "forever" files unless deleted manually.
It looks like the documentation pages have been updated / moved since that post. The information on Note History (and a lot more!) is now here.
Also in a post from a while ago Laurent explained how unused resources (attachments) should get automatically deleted.
So it seems to me that if you have Note History set at 90 days and you delete a resource from a note, 90 days later the is_associated database entry for the resource is set to 0 (assuming no other note uses that resource). Then "x days" after that it should get deleted.
I have no idea what the value of "x" is set to or, if it is something more dynamic, how it is calculated.
I am no authority on this, I am just piecing it together from previous posts on this forum and the Joplin site.
However if you have resources that have been missed by this process you can use the Joplin Batch Web Tool to search for any resources that are not referenced by any note and then delete them.