alangrainger / obsidian-google-photos

Connect to Google Photos from Obsidian
GNU General Public License v3.0
93 stars 5 forks source link

Creating new note for each photo #52

Closed PurposeRefined1179 closed 1 month ago

PurposeRefined1179 commented 2 months ago

Hi, I wanted to know if I can create a new photo for each photo I insert.

I thought of using Templater: Inserted markdown:

<%*
const folder = './Attachments';
const fileName = `{{taken_date}} - {{google_photo_desc}}`;
const fileContent = `
---
photo: {{google_base_url}}
taken: {{taken_date}}
---
![](=${tp.frontmatter.photo})
`;

const newFilePath = `${folder}/${fileName}.md`;
await tp.file.create_new(fileContent, newFilePath);
%>

(Note: it doesn't work properly. I probably have to add regex in fileName to remove illegal characters, if Templater has that, but you get the point)

Now, this would require an additional step (inserting the Templater template).

I wanted to know if there's a better way to do this or if it can be included as a feature in the plugin.

Thank you.

alangrainger commented 1 month ago

Hi @PurposeRefined1179 - great question. It won't be included in the plugin, but you could do this by making a Templater template which creates your new note and calls the Google Photos "Insert photo" command.

You would set up the template in Google Photos settings to have all of the above frontmatter etc just like you've formatted it in your post above.