rokokol356 downloadsFlexible and convenient gallery for images, GIFs, videos, and music.
Media Gallery is an Obsidian community plugin for rendering image, GIF, video, and audio galleries directly inside notes
It started as a fork and extensive rework of Luca Orio's Image Gallery plugin, which ATTRIBUTION.md credits, and keeps compatibility with the original img-gallery syntax while adding a broader mixed-media workflow
Flexible and convenient gallery for images, GIFs, videos, and music
img-gallery and img-galjpg, jpeg, png, gif, webp, tif, tiff, bmp, svg, avifmp4, webm, mov, m4v, ogvmp3, m4a, wav, ogg, oga, flac, aac, opusThe preferred code block name is:
```media-gallery
...
```
The following legacy aliases are also supported:
img-galleryimg-galhttps://github.com/user-attachments/assets/b0a7af89-3c26-4a6e-97ea-a22f0b3843ed
Use a vault-relative folder path to build a gallery dynamically
```media-gallery
path: media/Trip to Kazan
type: vertical
columns: 2
sortby: mtime
sort: desc
```
This mode scans the folder recursively. If path is omitted or set to *, **, ., or /, the plugin searches the whole vault
You can also use path patterns:
path: media/** — recursive search under media/path: media/* — only direct children of media/cats/cat? matches cats/cat1.png and cats/cat2.jpgUse embedded wiki-links, markdown image links, or direct paths/URLs
```media-gallery
columns: 2
type: vertical
![[photo.jpg]]
![[clip.mp4]]
![[track.mp3]]
```
This mode is ideal for Media Dump sections in daily, weekly, yearly, and hub notes
You can combine path with explicit embeds in the same block. The plugin loads media from the folder first, then appends explicitly listed items, while deduplicating identical entries by path
```media-gallery
path: media/Trip to Kazan
columns: 2
type: vertical
![[special-video-outside-folder.mp4]]
![[favorite-track.mp3]]
```
The plugin accepts YAML-like modifiers at the top of the block
| Option | Default | Values | Notes |
|---|---|---|---|
path |
* |
vault-relative path, *, ., / |
Folder mode only |
type |
vertical |
vertical, horizontal, mosaic, collage |
collage is treated as mosaic |
fit |
cover or contain |
cover, contain |
mosaic defaults to contain; others default to cover |
columns |
3 desktop / 1 mobile |
number | Most relevant for vertical |
mobile |
1 |
number | Mobile column count |
height |
260 |
number | Base tile height |
gutter |
8 |
number | Gap in pixels |
radius |
0 in folder mode, 10 in explicit mode |
number | Border radius in pixels |
sortby |
ctime |
ctime, mtime, name, rand, random |
rand and random act as aliases for random ordering |
sort |
desc |
asc, desc |
Folder mode only |
extensions |
none | comma-separated list or YAML array | Keeps only matching file extensions |
exclude |
none | comma-separated list or YAML array | Excludes matching paths or patterns |
limit |
0 |
number | Limits how many media items are rendered after filtering and ordering; 0 disables the limit |
seed |
random | string or number | Makes sortby: rand or sortby: random deterministic when set |
waveform |
true |
true, false |
Audio preview visualization |
spectrogram |
false |
true, false |
Uses spectrogram instead of waveform |
Examples:
extensions: jpg, png, mp4exclude: media/private/**, media/tmp/*, voice-note.mp3sortby: randlimit: 24seed: trip-2025https://github.com/user-attachments/assets/6f7ff6e7-17e1-46a0-bed1-d2fd9ad9118f
verticalMedia Dump blockshorizontalmosaicfit: contain to reduce aggressive croppingcollagemosaictitle, artist, album, and embedded cover art when availablespectrogram: true```media-gallery
type: vertical
columns: 2
spectrogram: true
![[track-01.mp3]]
![[track-02.flac]]
![[track-03.m4a]]
```
Enable cache — caches the vault media list and folder lookups in memoryEnable flexible path patterns — enables advanced wildcard patterns such as media/**/concert* or media/2025-??folder/*, and folder/** stay on the fast path either wayMatch wildcards against file names — when enabled, wildcard parts match file names and the directory part only scopes the search; when disabled, flexible wildcards match against the full pathEnable audio visualizations — toggles waveform and spectrogram renderingAutoplay audio on open — starts playback automatically when opening an audio cardcanvas for better scroll performance than large DOM gridstype: verticalfit: coverheight: 260gutter: 8limit: 0type: verticalfit: coverheight: 260gutter: 8radius: 10waveform: truespectrogram: falselimit: 0```media-gallery
columns: 2
type: vertical
![[photo-1.jpg]]
![[photo-2.jpg]]
![[clip.mp4]]
![[voice-note.mp3]]
```
```media-gallery
path: "*"
type: vertical
columns: 2
```
path: "**" works the same way as path: "*"
```media-gallery
path: media/**
type: vertical
columns: 2
```
```media-gallery
path: media/*
type: vertical
columns: 2
```
```media-gallery
path: media/**
extensions: jpg, png, mp4
exclude: media/private/**, media/tmp/*
sortby: rand
limit: 24
seed: trip-2025
type: vertical
columns: 2
```
```media-gallery
type: horizontal
height: 280
gutter: 12
![[photo-1.jpg]]
![[photo-2.jpg]]
![[photo-3.jpg]]
```
```media-gallery
type: mosaic
fit: contain
height: 280
![[photo-1.jpg]]
![[photo-2.jpg]]
![[photo-3.jpg]]
```
main.js, manifest.json, and styles.css.obsidian/plugins/media-gallery/npm ci
npm run check:types
npm run lint
npm run build
npm run lint uses eslint-plugin-obsidianmd, which is the same family of checks recommended by the Obsidian submission bot for local preflight validation
Use npm run check:types, npm run lint, and npm run build before release changes. src/ is now the source of truth for the shipped main.js
Path errors can be disabled in plugin settings via Show path and empty-gallery errors if you prefer empty blocks over inline error messages