trganda / obsidian-attachment-management

Attachment Management of Obsidian
MIT License
168 stars 11 forks source link

Make file name of attachment available as key #10

Closed floli closed 1 year ago

floli commented 1 year ago

Given the list of keys from the option page, there is no option to use the original filename of the attachment, i.e. what I want to have file.pdf renamed to 2023-05-16 file.pdf.

What be cool to have {{attachmentFileName}} available.

trganda commented 1 year ago

Need a variable to represent the old name of attach (before last rename operation)? Or the original name before using this plugin?

i.e. origianl name: file.pdf after first time renamed name: 2023-05-16 file.pdf after second time renamed name: 2023-05-17 2023-05-16 file.pdf or 2023-05-17 file.pdf

floli commented 1 year ago

What I need is the original file name, i.e., the name before I moved it into Obsidian.

trganda commented 1 year ago

This feature need to persisten the attachment name, with the growing of vault, the cost of this plugin will be heavy.

Btw, we could add a option to enable append the attachment name (set in settings) to prefix or suffix of the attachment that need to be renamed.

floli commented 1 year ago

My intention was not keep the original name for later renamings, but only use for the initial renaming when a file is added to the vault. Later, of course, the original file is lost.

Best!

trganda commented 1 year ago

I have know you request.

We could add a variable like ${attachmentFileName} in Attachment format field, and if the variable was used for one note, the auto rename will disable for it.

Currently, If you don't need to renaming the file in future but only for first adding to vault, your can turn off the Automatically rename attachment, of cause it will close the auto rename globaly right now.

Mara-Li commented 1 year ago

It is maybe possible to keep the original filename on a variable, the first time the file is added to a vault, and during the renaming, in place of using the date (for example), apply the original filename? Or maybe rename it "two times" ?
I think you can apply the new path & apply the original name right after ?

trganda commented 1 year ago

Hi, @floli. You can use ${originalname} as the original name in attachment name in 0.5.0.

Tks for @Lisandra-dev's work.

breakstar commented 1 year ago

image

I'm sorry to bother you. Your software is very practical, but I encountered a little problem in the process of use, I would like to consult you. I used {originalname}}, copied the image in Explorer, then pasted it twice in OB editor, there was always no renames, and the two photos were stored in different paths.

trganda commented 1 year ago

image

I'm sorry to bother you.很抱歉打扰你。 Your software is very practical, but I encountered a little problem in the process of use, I would like to consult you.你们的软件很实用,但是在使用过程中遇到了一点问题,想咨询一下。 I used {originalname}}, copied the image in Explorer, then pasted it twice in OB editor, there was always no renames, and the two photos were stored in different paths.我使用了{originalname}},在资源管理器中复制了图像,然后在OB编辑器中粘贴了两次,始终没有重命名,并且两张照片存储在不同的路径中。

The ${originalname} will be replace with the filename that you pasted. And what's your filename? Snipaste_2023-07-25_11-51-41 1.jpg?

Have you modifed the Attachment format between twice paste?

I have try to set Attachment format as IMG-${originalname} and paste a png with name Crayon.png in same file. The result is below

image

Can you explain more detail of your situation

breakstar commented 1 year ago

image I'm sorry to bother you.很抱歉打扰你。 Your software is very practical, but I encountered a little problem in the process of use, I would like to consult you.你们的软件很实用,但是在使用过程中遇到了一点问题,想咨询一下。 I used {originalname}}, copied the image in Explorer, then pasted it twice in OB editor, there was always no renames, and the two photos were stored in different paths.我使用了{originalname}},在资源管理器中复制了图像,然后在OB编辑器中粘贴了两次,始终没有重命名,并且两张照片存储在不同的路径中。

The ${originalname} will be replace with the filename that you pasted. And what's your filename? Snipaste_2023-07-25_11-51-41 1.jpg?

Have you modifed the Attachment format between twice paste?

I have try to set Attachment format as IMG-${originalname} and paste a png with name Crayon.png in same file. The result is below

image

Can you explain more detail of your situation

Thank you very much for your reply. The source file name is: 'Snipaste_2023-07-25_11-51-41.jpg', copy and paste from the Explorer to the ob editor, do not make any changes, continue to paste to the ob editor, there is no rename situation, and the paths of the two images are different. attachment-format: IMG-${originalname}-${date}