konfetigr88 downloadsConvert code blocks with ![[images]] into interactive galleries.
A simple image gallery and viewer plugin for Obsidian that transforms how you view and organize images in your notes. Features responsive galleries, advanced image viewing with zoom and pan, and seamless mobile support.
The main distinction from similar plugins is that you can create a gallery within a specific note based on the attachments that have already been added. In other plugins I found, you are prompted to select a folder containing images from which a magnificent gallery will be generated. This is particularly useful when you have a large knowledge base without folder-based organization.
Create image galleries using code blocks:
```gallery
![[image1.jpg]]
![[image2.png]]
![[folder/image3.webp]]
![[image4.jpg]]
``
Select all the images you wish to add to the gallery and run the Templater script, and it will merge them.
<%*
const editor = this.app.workspace.activeEditor?.editor;
if (!editor) return;
const selection = editor.getSelection();
if (selection) {
const galleryBlock = `\`\`\`gallery\n${selection}\n\`\`\``;
editor.replaceSelection(galleryBlock);
} else {
const content = editor.getValue();
const imageRegex = /!\[\[.*?\]\]/g;
const images = content.match(imageRegex);
if (images && images.length > 0) {
const galleryBlock = `\`\`\`gallery\n${images.join('\n')}\n\`\`\``;
editor.setValue(galleryBlock);
} else {
new Notice('No images found in document');
}
}
%>
This project is licensed under the MIT License - see the LICENSE file for details.
Note: This plugin is not officially endorsed by Obsidian. Use at your own risk. Always back up your vault before installing new plugins.
Made with ❤️ for the Obsidian community