Skip to content

Conversation

@l3ickey
Copy link

@l3ickey l3ickey commented May 14, 2025

This PR adds a new feature to automatically upload external image links in Obsidian notes to S3 and replace them.

Key changes:

  • Add a new command "Convert External Images to S3"
  • Execute the process in 3 stages:
     1. Replace ALT text in external image links with file hash
     2. Run Obsidian's "Download attachments for current file" command
     3. Upload downloaded images to S3 and replace original links
  • Implement automatic detection of download completion
  • Automatically remove duplicate S3 links

Example of the transformation process:

Initial external image: ![image](https://example.com/img.png)

  1. After Step 1 (hash generation): ![a82b844446ae6b9bb95c47d806265e4a.png](https://example.com/img.png)
  2. After Step 2 (download): Both ![[img.png|a82b844446ae6b9bb95c47d806265e4a.png]] and ![image](https://obsidian-bucket.s3.ap-northeast-1.amazonaws.com/a82b844446ae6b9bb95c47d806265e4a.png) exist in the document
  3. After Step 3 (cleanup): Only ![image](https://obsidian-bucket.s3.ap-northeast-1.amazonaws.com/a82b844446ae6b9bb95c47d806265e4a.png) remains

This feature makes it easy to migrate notes containing image links from other sources to S3 hosting.

@jvsteiner
Copy link
Owner

It would be a lot easier for me to review this if you could squash these into a single commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants