question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only the first local image will render on a table

See original GitHub issue

What happened?

When I display local images in Dataview, only the first image will appear. The subsequent images don’t have an img tag within them and don’t display. If I change the sort on the table to change the order in which items appear, the one that was displaying stops working and the one that wasn’t displaying begins to display.

  1. Image A (displays)
  2. Image B (doesn’t display)

change sort from asc to desc:

  1. Image B (displays)
  2. Image A (doesn’t display)

If I group my results, the first entry for each group will display.

Console is empty with no errors.

For testing purposes I created two files that only contain front matter:

---
image: 1984%20The%20Graphic%20Novel%20(2021).jpg
---

and

---
image: 4%20Kids%20Walk%20Into%20A%20Bank%20(2016).jpg
---

DQL

 dv.table(["Cover", "Name"],
 dv.pages('"Notes/Comics"')
    .where(f => f.image)
    .sort(f => f.image, 'asc')
    .map(k => [`![](${k.image})`, k.file.link]))

image

 dv.table(["Cover", "Name"],
 dv.pages('"Notes/Comics"')
    .where(f => f.image)
    .sort(f => f.image, 'desc')
    .map(k => [`![](${k.image})`, k.file.link]))

image

JS

No response

Dataview Version

0.4.26

Obsidian Version

0.13.23

OS

Windows

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
chelmingcommented, Mar 7, 2022

Figured out the img src on mobile. Had to use <img src="${app.vault.adapter.getResourcePath("Media/Comics/"+k.cover)}"> to get it to render properly.

1reaction
XSAMcommented, Oct 26, 2022

Thank you @chelming!

I now use <img src="${app.vault.adapter.getResourcePath(p.avatar.path)}">. avatar is a field, the value could be ![[img.png]].

It works on macOS and iOS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to render **local** image in pandas dataframe
png , this simple solution seems to work (I see the pictures rendered in the HTML table). import pandas as pd from IPython.core.display...
Read more >
Images not rendering in table · Issue #114 · glin/reactable
I'm almost there with completing my first table using the reactable package, however the images I'm trying to add into the table aren't...
Read more >
Lazy Loading Images – The Complete Guide - ImageKit.io
Images on a webpage can be loaded in two ways - using the <img> tag, or using the CSS `background` property. Let's first...
Read more >
Render local images in datasette using ... - Technical Ramblings
Render local images in datasette using datasette-render-local-images ... Datasette python library lets publishing a dataset as a SQLite database and inspects them ...
Read more >
Helper function for adding a local image — local_image • gt
We can flexibly add a local image (i.e., an image residing on disk) inside of a table with local_image() function. The function provides...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found