yy4382464 downloadsUpload images in a note, and remove the images from the vault if they're exclusively used within that 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.
[!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.
Custom Uploader Class option empty.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.