Joplin.data.get Access to images in /resources

Hi all,

is there a way to access the raw image on the filesystem from the plugin?
With the REST API I can GET /resources/:id/file https://joplinapp.org/api/references/rest_api/#get-resources-id-file but need the token. The joplin.data module does not allow this in .get (yet?). The settings does not allow to access the local base path of the file system.

Any idea is greatly appreciated!
Jakob

Background:

I am trying to create a plugin for making a webview of thumbnail versions of images across all notebooks and notes.

Here is what I would like.

  1. get resources using const resources = joplin.data.get(["resources"] )
  2. iterate over all resource.id to retrieve the id.[png|jpg|gif]
  3. retrieve raw file from file system
  4. create thumbnail with e.g. https://github.com/KnicKnic/WASM-ImageMagick
  5. create < a href > links with note.id from table note_resources in sqlite as image gallery in webview
  6. ???
  7. profit from visually searching the ca. 500 images in my notes

I think joplin.data.get(["resources", resourceId, "file"] should work?

1 Like

Brilliant, it does!
Thanks you for the fast and helpful reply!
Jakob