Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to keep external URL link even when downloading images to local computer? #36

Open
KoichaDev opened this issue Aug 10, 2023 · 3 comments

Comments

@KoichaDev
Copy link

I have used Microsoft OneNote extensively in the past. One thing I like about their feature is that the images I uploaded on my notes, it was linked automatically to my account Microsoft OneDrive.

Every time when I went to reinstall and re-download the notes, the image that comes with the notes will download to my local computer automatically and use the image paths that have been downloaded but still keep the external URL backup just in case something is going to happen.

These features from OneNote made me feel safe. Right now when I try to use this plugin and download the external URL image, then what happens is that the external URL is overwritten and points to the reference of the local Obsidian media folder instead, and this makes me feel insecure! What if the images I have on my local computer do not exist anymore if I need to download my Obsidian Vault to another computer one day?

It would be very nice if this plugin can behave like Microsoft OneNote.

Hope to hear from you @Sergei-Korneev 🙂

@KoichaDev KoichaDev changed the title Possible to keep external URL link even when downloading it to local computer? Possible to keep external URL link even when downloading images to local computer? Aug 10, 2023
@Sergei-Korneev
Copy link
Owner

If I will have time for this, probably the next version will allow users to define some sort of template to replace original links.

@KoichaDev
Copy link
Author

If I will have time for this, probably the next version will allow users to define some sort of template to replace original links.

Thank you @Sergei-Korneev! This feature will be most appreciated! 🙂

@eatcosmos
Copy link

我过去曾广泛使用过 Microsoft OneNote。我喜欢他们的功能的一件事是,我在笔记上上传的图像会自动链接到我的帐户 Microsoft OneDrive。

每次我重新安装并重新下载笔记时,笔记附带的图像都会自动下载到我的本地计算机,并使用已下载的图像路径,但仍保留外部 URL 备份,以防万一发生。

OneNote 的这些功能让我感到安全。现在,当我尝试使用此插件并下载外部 URL 图像时,发生的情况是外部 URL 被覆盖并指向本地黑曜石媒体文件夹的引用,这让我感到不安全!如果有一天我需要将我的黑曜石保险库下载到另一台计算机上,我本地计算机上的图像不再存在怎么办?

如果这个插件可以像Microsoft OneNote一样运行,那就太好了。

希望收到您的🙂来信

直接在插件的脚本里修改main.js,我花了一晚上,真的疯了,以后不能熬夜了。
主要就是 复制网络图片地址到笔记后,笔记里还是网络url,不会被替换为本地URI。
还有就是保持本地图片名称和网络名称一致,这样的好处是为了方便以后能用本地图片替换网络图片。

I directly modified the main.js in the plugin's script. I spent the whole night on it, I'm really going crazy. I can't stay up late anymore in the future.
The main point is that when copying the URL of a network image to the note, the note still shows the network URL and will not be replaced with a local URI.
Another thing is to keep the local image name consistent with the network name, the benefit of doing this is to facilitate replacing the network image with a local image in the future.


const pathArray = new URL(link).pathname.split('/'); //todo 1
const fileNameWithExtension = pathArray[pathArray.length - 1];
// fileName = fileNameWithExtension.split('.')[0];
fileName = pathJoin([dir, fileNameWithExtension]);

![[Pasted image 20240115011650.png]]

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

No branches or pull requests

3 participants