When presented in card form, Obsidian Bases usually specify the image attribute (as shown in the image below, the cover_image_url), which will display the image at the top of the card. However, if not every note has a specified image attribute, is it possible to retrieve the first image in the note to use as the note’s thumbnail? If so, how should the Base’s property be configured?
This method applies only to image files stored locally. Image URLs are not applicable.
▼ cover_image_url is the image URL (starting with http:// or https://)
1. Table View
file.embeds is an object you can use to query all embedded files in a note. It returns a list of file objects, each representing an embedded file.
- Add formula image (image file name):
file.embeds[0] - Add formula thumbnail (image thumbnail):
image(file.embeds[0])to display the image file graphically - Filter condition:
file.embeds[0].containsAny("png", "jpg", "gif")
2. Card View
- Add formula image (image file name):
file.embeds[0] - Filter condition:
file.embeds[0].containsAny("png", "jpg", "gif") - Card view setting: Choose formula image for Image property
- Image fit: Choose Cover to fill the image, or Contain to display the full content.
3. 💡 Related Links
✅ Explanation article (Traditional Chinese): https://jdev.tw/blog/8898/
✅ Explanation article (English)
✅ 解説記事(日本語)
✅ Reference (Japanese): Obsidian Bases 入門|松濤Vimmer
✅ Reference: 「Bases」设置笔记中第一张图片为卡片封面 - 经验分享 - Obsidian 中文论坛