lucaorio / obsidian-image-gallery

A zero setup masonry image gallery for Obsidian
MIT License
195 stars 15 forks source link

Add support for image previews #8

Closed mirnovov closed 1 year ago

mirnovov commented 1 year ago

Closes #5

This adds support for showing a popup with the image upon click. It is disabled by default, but can be enabled upon setting the preview: true property. The popup shows the image name and options to open in a new tab or search for it in other notes, but this can be changed/extended in the future.

Note this PR also includes a bit of restructuring to make it possible, such as splitting the styles off into a separate stylesheet. I have tried to change as little as possible and keep to the extant coding style, but this couldn't be implemented without changing a bunch of stuff.

deurk commented 1 year ago

Good addition, thanks @mirnovov! Is there any way the plugin could support images outside the vault?

For example, on the same disk/filesystem, vault is in /vault and files would be under /storage/pictures.

lucaorio commented 1 year ago

@mirnovov, thank you so much for the PR! 🙏 Sorry it took me so long to get back to you, but life has been… busy.

Last night I merged locally and then wanted to add some thumbnails at the bottom, introduce support for mobile, and so on. I quickly got into a rabbit hole trying to build all of this from scratch.

So, I ended up leveraging https://www.lightgalleryjs.com/ fully, and with that, we get almost everything for free. Please let me know what you think of it, and sorry if you invested your personal time just to see the PR not being merged. :(

lucaorio commented 1 year ago

Is there any way the plugin could support images outside the vault?

@deurk I'm sure something could be hacked together for something like that, but AFAYK Obsidian doesn't provide any tool to access files outside the vault, nor encourages it as a best practice!

mirnovov commented 1 year ago

@mirnovov, thank you so much for the PR! 🙏 Sorry it took me so long to get back to you, but life has been… busy.

Last night I merged locally and then wanted to add some thumbnails at the bottom, introduce support for mobile, and so on. I quickly got into a rabbit hole trying to build all of this from scratch.

So, I ended up leveraging https://www.lightgalleryjs.com/ fully, and with that, we get almost everything for free. Please let me know what you think of it, and sorry if you invested your personal time just to see the PR not being merged. :(

No worries, I totally understand, especially as I changed a whole bunch of stuff up. Thanks for developing the plugin in the first place, which is what really matters.