gavvvr / obsidian-imgur-plugin

Pastes images right to imgur.com
MIT License
218 stars 58 forks source link
imgur obsidian-md obsidian-plugin

Obsidian Imgur Plugin

Maintainability Rating Installations count

This plugin uploads images to imgur.com instead of storing them locally in your vault.

obsidian-imgur-plugin-demo

Why?

Obsidian stores all the data locally by design (which is perfect for text and, in my opinion, can be improved for images). If you often add pictures to your notes, your vault can quickly grow in size. Which in turn can lead to reaching limits if you use free plans of cloud storage services to sync your notes or can lead to growth of repository size if you use git to back up your notes.

This plugin is a perfect solution for people who paste images to their notes on daily basis (i.e. students making screenshots of lecture slides) and do not want to clutter their vaults with image files.

Having remote images also makes it much easier to share a note with anyone else, you will only need to share a single file.

If you are uncertain if this solution is for you, you can check out the FAQ section and/or a video created by @santiyounger discussing pros and cons of this approach

Santi Younger - Use Images Like A Pro

Features

Installation

Install the plugin via the Community Plugins tab within Obsidian

Getting started

Generating Client ID

For this plugin to work reliably and to avoid hitting daily rate limits from using single shared Client ID, it was decided that each user should create his own "Client ID". Here are the steps:

  1. If you do not have an Imgur account, you need to get one first - follow https://imgur.com/register
  2. Being authenticated, go to https://api.imgur.com/oauth2/addclient
  3. Use any name for "Application name". For example: "Obsidian Imgur plugin"
  4. Choose "OAuth 2 authorization with a callback URL"
  5. Important: use obsidian://imgur-oauth as an "Authorization callback URL" value
  6. Fill in the "Email" field and proceed to get your Client ID

Configure just received Client ID in Obsidian Imgur plugin settings[^1].

After creation, Client ID can be managed at: https://imgur.com/account/settings/apps

[^1]: You will only need to configure Client ID in Imgur plugin settings, secret is not required.

Authenticated upload

Go to plugin's settings, select 'Authenticated Imgur upload' and complete authentication. That's all! Now you are ready to make notes and upload all your images remotely. You will see all your uploaded images at https://your_login.imgur.com/all/

Anonymous upload

You might not want to see your Obsidian images tied to Imgur account.

For this case there is an 'Anonymous Imgur upload' option.

FAQ

Q: How secure this approach is?
A: Nobody sees your uploaded image unless you share a link or someone magically guesses an URL to your image.

Q: Can I remove a remote image uploaded by accident?
A: For authenticated uploads - yes, go to https://your_login.imgur.com/all/, for anonymous uploads - no (it is technically possible, but you will need a deleteHash which is not recorded. I would record it, but there is no place for logging in Obsidian yet)

Q: For how long an image stays at imgur.com? Is there a chance to lose the data?
A: For authenticated uploads, I guess they are never deleted. What about anonymous uploads? Earlier it was stated on Imgur website that the image you upload stays forever. I think this is true since 2015. Today I could not find this statement on Imgur website. I can assume that images that did not receive any view for years, can be removed, but there is nothing to worry about. You can read my detailed thoughts on this in discussions

Q: Imgur supports videos. Does the plugin support videos upload?
A: No. Initially, I did not consider videos upload support since there is no Markdown syntax to embed videos. On the other hand, you can simply use <video> HTML tag, so I will probably add support for videos in future

Q: Can it upload images to some other service?
A: For now, there are no plans to support other image hosting solutions, but it should not be difficult for you to make a fork and create your own implementation of ImageUploader interface.

Discussion

If you have any questions/suggestions, consider using GitHub Discussions. There is also a plugin's thread on Obsidian forum.

Known limitations

Known issues

Contribution

Contributions are welcomed. Check out the DEVELOPMENT.md to get started with the code.

Your support

If this plugin is helpful to you, you can show your ❤️ by giving it a star ⭐️ on GitHub. You can also buy me a coffee using Ko-fi:

ko-fi