How to resize image with query?

What I’m trying to do

I have many notes for books that I’ve read. Each of those notes include a line like:

Cover:: ![[Pasted image 20221108221346.png|200]]

So I keep the image of the cover in my vault. In order to display the cover image on all those pages in a consistent manner, I added the |200 part to the line.

When I create a dataview query to list my books, I use:

TABLE Cover
WHERE class = "Book"

So far, so good. But now I want to be able to influence the size of the cover image in my table.

How can I make sure that the |200 in the Cover field returned by the query above is replaced with for example |100?

I just learned about regular expressions so here’s what I’d try:

TABLE regexreplace(Cover, "(?<=|)[0-9]+(?=]])",  "100")
WHERE class = "Book"

That should find a sequence of digits of any length that is between a pipe character and two closing angle brackets, and replace it with “100”.

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