Embed remote images

Many of my imported Evernote images are loaded from remote URLs, which is not sustainable as long-term achive. It would be useful to have a function for embedding all (or selected) external images.

3 Likes

I don’t see that being part of the main app, but it could be done relatively easily with a script that would process all the notes, and swap the image URLs with a resource ID.

Yes, I’d also like that. How could it be done?
I’m not sure how the script is supposed to store the image from an URL into a resource and get its ID - I don’t see that in the API docs.

Also, why don’t you think it’s a good fit for the app itself? Considering how popular the scraper is, I’d think making local copies of images would be in demand. (I’m not saying it is - I’m probably biased here.)

The script would do something like this:

  • Get all notes
  • Parse each note and extract the image URLs
  • For each image URL, download the image
  • Create a resource from the image using POST /resources
  • Swap the image URL with the resource ID

In Joplin, normally there's nothing that allows inserting an image URL. If you paste an image, it creates a resource, if you import an image, it makes a resource. If you clip a web page, it converts all the images to resources. The only case there can image URLs I guess is if if imported Evernotes notes had links to external images (normally they are all embedded images which are also converted to resources), so that's why it's a bit of an edge case, so making it part of the main app should not be necessary.

Actually @cloo, do you have an example of ENEX file with these external image URLs? Maybe what should be done is convert these to resources on import.

Just noted that external (plain text) links to images aren't previewed like images from resources.

Since plugin system is in place, i think i could make plugin that would parse note (just active one for a start), create resources and swap plain text urls into ![](:/resourceId)

The thing that bugs me is how to keep reference to source url somewhere in the note without causing infinite loop.
Laurent, any ideas?

1 Like

I am also interested in this feature! I would even like if link and image would remain in the note.
Any news or possibilities for this?

I had a plugin request here but it was closed due to inactivity:

Can anybody make a plugin to fetch the image behind the link and paste it below the link in the note?
Or give me a hint how to make one on my own?
I am pasting multiple such links daily into my notes and it would save me much time.

Thank you very much in advance!

This is the preview function, which can be achieved

Which one do you mean?

This could maybe be part of the Paste Special plugin that is worked on for GSoC.

1 Like

Sure @kally, this can be achieved by converting the image url to blob base 64 encode and adding it to the note. I'm working on Paste Special project as @tessus mentioned above. Although tessus, the priority of GSoC project is converting and pasting csv to markdown and getting the best out of that feature but surely this addon can be added to project future development or if timeline is spared.

Yes, I agree. However, the GSoC should make a modular approach possible. I believe one of the parts of the project is to create a framework for different Paste Special actions, even though only one action was planned for the GSoC.

1 Like

If I understand well, the question is about displaying a preview of the website below the link, is that correct? In that case, you'll have to bundle a headless browser with the plugin or somehow leverage Electron to render the website to a thumbnail. Either way, that's probably out of scope for GSoC, and perhaps not really related to Paste Special?

I think it was about (downloading the image as attachment and) showing the image, if the link points to an image.

P.S.: This shouldn't be done autonatically, but a Paste Special > Insert link as image could do the trick.

Yes, that's the idea.. to make it modular as possible, so as to increase it's functionality for different file formats.

1 Like

Hmm, there are several things in this thread so not sure what we're talking about. Pasting text that contains image URLs already downloads the image and converts it to a local resource, so it's already implemented. The original post is about ENEX import, which is unrelated.

1 Like

Oh laurent i guess tessus was talking upon sally's concern with the image pasting by url as her post was revoked due to being not resolved or replied, mentioned above. Although, if that's already been developed. Please do lead her way.

I am confused too now but my request was to paste a link to an image and joplin should insert the image below the link.
It would not bother me if I would have to first paste the link as text and then a second time as Paste Special > Insert link as image as I need both, link and image.
Is this possible or planned in any way?

That seems like a convoluted way to do something simple. Why not paste the image directly? In your browser you can right click on the image and "Copy image" then paste this image in Joplin.

Edit: ok now I get it, you also want to keep the link to the image.

Yeah kally. The idea is to create a function to paste image from a link to an image (aws s3, in your example), that will be pasted as image below the link in the editor. So, you'd have both shown in editor.