Image Uploader For Note
approvedby Yunfi
Upload images in a note, and remove the images from the vault if they're exclusively used within that note.
Image Uploader (for one note)
An Obsidian plugin for uploading images in notes!
It uploads local images in a note to S3 (and S3 compatible services), replace the image link with the S3 link, and remove the images from the vault if they're exclusively used within that note. (optional).
Or, instead of S3, you can write a custom function to upload the image via Custom JS plugin.
Usage
[!NOTE] This plugin is still in waiting for approval to be listed in the official community plugins. Track the progress here. For now, you can download the latest release from the releases page and install it manually.
Use the button on Ribbon or the command palette to upload images in currently opened note.
Use S3 uploader
- Fill in the S3 configuration in the settings.
- Leave the
Custom Uploader Classoption empty.
Use custom uploader
You need to install the Custom JS plugin first.
Add a class to your custom js file, which need to have a function named upload, with the following signature:
async function upload(
binary: ArrayBuffer,
tFile: Pick<TFile, "basename" | "extension" | "name" | "path">
): Promise<string>;
And then set the Custom Uploader Class option in the settings to the class name.
For example, if you have a class named CustomUploader in your custom js file:
class CustomUploader {
async upload(
binary /* ArrayBuffer */,
file /* Pick<TFile, "basename" | "extension" | "name" | "path"> */
) {
console.log(file.name, file.path);
// https://docs.obsidian.md/Reference/TypeScript+API/requestUrl
await requestUrl({
url: `https://api.example.com/upload?path=${encodeURIComponent(
file.path
)}`,
method: "POST",
body: binary,
});
return `https://example.com/${file.path}`;
}
}
Then set the Custom Uploader Class option in the settings to CustomUploader.
What the difference between this plugin and others?
- this plugin can remove the local images from the vault if they're exclusively used within that note (and this behaviour is optional). This is useful if you want to keep your vault clean.
- this plugin is more flexible, you can write your own uploader class to upload images to any service you want.
- upload images by manually trigger, not when pasting images. This prevents uploading images that you don't want to upload.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.