First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.
What I’m trying to do
For every book I have a note generated with booksearch plugin. I have a YAML in which there is a link to a cover image. Every so and often booksearch can’t find a image for a particular book and neither I can with google image.
I created a bookshelf using many tips from Bucaneer
Having local images I use in field of my YAML
cover: [[coverbook.jpg]]
while for cover image
Now, if I use this query dataview I can view my cover image taken from web in the bookshelf:
TABLE WITHOUT ID file.link AS "Titolo", author as Author, ("![|100](" + cover + ")") as Cover,
rating as Voto, Anno_di_lettura as "Anno letto", pages as "Pag."
From "002 Reading"
WHERE file != this.file
For cover image from web I have:
(“![|100](” + cover + “)”) as Cover,
with another query dataview I can see local images:
TABLE WITHOUT ID file.link AS "Titolo", author as Author, embed(link(cover, "150")) as Cover,
rating as Voto, Anno_di_lettura as "Anno letto", pages as "Pag."
From "002 Reading"
WHERE file != this.file
Where I use this code for visualizing local image:
embed(link(cover, “150”)) as Cover,
Last code came from this discussion Local image
(solution by mnvwvnm)
PROBLEM:
With first query I can’t see local image
And obviously I can’t see the first two images when I use the second query.
Is it possible to create a if-then clause for having both kind of images?
Things I have tried
I tried several solution without success. I can’t create a query in which web cover and local image can be seen in one bookshelf
embed(if(contains(cover, “http”) || contains(cover, “https”), link(cover, “150”), “file:///Users/gabriele/Documents/Obsidian%20Vault/Attachment”)) AS “Cover”,
choice(contains(cover, “http”) || contains(cover, “https”), embed(link(cover, “150”)),
embed(if(contains(Cover, “http”) || contains(Cover, “https”), link(Cover, “150”), (“./” + Cover))) AS “Cover”,