I used to use Google Photos (and am the author of the Google Photos plugin), but I switched to Immich for reasons I mention in the readme there.
I wanted an easy way of embedding images from Immich into my notes. Originally I had planned to write a new plugin, but I came up with a super quick option that only uses Templater. For me it does everything I need.
The workflow is:
- Browse any photo on Immich.
- Copy the URL or photo link.
- Back in Obsidian, run the template (from a hotkey). It will detect the Immich photo from the clipboard, and insert it as a thumbnail with a link back to Immich for the full-size image.
Setup
Step 1
Create an API key inside Immich, with only asset.view permissions.
Step 2
Create a new Templater template, with the following code.
- Replace
BASE_URLwith your Immich host. - Replace
KEYwith the API key from Step 1. Double-check and make sure you have given onlyasset.viewpermissions and nothing else.
<%*
const BASE_URL = 'https://your-immich-server.com'
// An API key with asset.view permissions:
const KEY = 'API_key_with_asset_view_permission'
// Check the clipboard for a copied photo link
let id = getPhotoId(await tp.system.clipboard())
if (!id) {
// Nothing in the clipboard, prompt for a photo link
const link = await tp.system.prompt('Paste in an Immich photo link')
id = getPhotoId(link)
}
if (id) {
tR += `[](${BASE_URL}/photos/${id}) `
}
function getPhotoId (text) {
if (typeof text !== 'string') return
// Is it a photo page?
let match = text.match(/^http.*?\/photos\/(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})$/)
if (match) return match[1]
// Is it a direct image URL?
match = text.match(/\/api\/assets\/(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/)
if (match) return match[1]
}
-%>
Step 3
If you want, set a hotkey for that template, to make it faster to insert images.
Any future changes to this guide will be updated here.