Dataview : path to an image stored on iCloud?

What I’m trying to do

Hello
I’m new to Obsidian and to this forum, but I recently discovered the wonderful Dataview, plugin that I want to use to generate a list of my recipes with small pictures as illustrations.

I managed to get the desired pictures using images stored locally on the hard drive of my computer (Mac) by using :

  • in the YAML :

Cover: file:///Users/pipoune/Documents/TomatoSalad.jpeg

  • and the following Dataview query :
TABLE 
	("![coverimg|90](" + Cover + ")") as Illustration

The problem is that, obviously, as the images are local, they do not appear when I view the table on my iPad.

So I would like to find a way to use images stored on iCloud instead of images stored on my hard drive. But I haven’t found a way to put a valid path to the icloud images in the YAML, that can be used by Dataview… I tried to copy the path from the iCloud location but without success. Drag and drop the picture to Obsidian note with ALT key (CTRL on windows) held down doesn’t work either.

Do you know if it is possible and if so, how to do it? I couldn’t find any subject on this topic in the forum.
Thanks in advance !

PS: I apologize for my English, I am French and I surely make mistakes!

I would suggest that you move your pictures into your vault. That way they get sync’ed along with the other notes, and you know where they are at all times.

This also allows for easily embedding of the images into your notes and tables.

Thanks for your reply.
My pictures are actually in my vault, and my vault itself is located on icloud. This way it is synced between my Mac and my Ipad.
And therefore I’m looking on a way to refer to my pictures in my vault on icloud ;-).

And what’s missing from embedding your picture within the vault? Do you need outside links into the vault, or which part am I missing?

Why don’t ![[YourPicture]] do the trick? (Sorry, if I’m totally missing the point here)

It’s just that if I use the type of format you suggest in the frontmatter, i.e. :

it is not recognized by the Dataview query.
In this case, in the table, instead of having the image itself displayed, only the text ![[MyPicture]] appears.

1 Like

Have you tried the same code as you were using before but with a relative url for the image (relative to the vault root)?

Cover: /images/TomatoSalad.jpeg
TABLE 
	("![coverimg|90](" + Cover + ")") as Illustration

Try this in the YAML:

---
Cover: "![[TomatoSalad.jpeg]]"
---

And then you could try this line as part of the query as a simple test:

cover AS COVER

The sample below (editing mode on the left; reading mode on the right) shows an image that is stored in my vault which is kept on iCloud to sync between my Mac and iPhone.

Just an alternative to @eightning solution.
You can use in frontmatter

---
Cover: "[[TomatoSalad.jpeg]]"
---

and use the function embed() in table query

embed(Cover) AS COVER

If you want to control the size:

embed(link(Cover, "150")) AS COVER
1 Like

Very nice, @mnvwvnm

Are there inherent advantages or disadvantages associated with each method?

Thanks

All depends on you (and the context). :slight_smile:
For example:

  • if an inline field and I don’t want to see the embed of the image, then I use the version [[image]] without the “!”.
  • the use of the link method allow us to define the size (as in expression "![img|90](" + Cover + ")")
1 Like

Thanks. Food for thought. :thinking:

I completely missed that you, for some reason, want to store the filename in the YAML. Thankfully these other guys picked up on that, and provided seemingly good solutions.

A huge thank you to you both, eightning and mnvwvnm, for your solutions that work perfectly and are so simple!
I am very happy to be able to change the size of the image thanks to the Embed(link) function :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.