Giter Site home page Giter Site logo

gall's Introduction

go-masonry-gallery

This repo contains a CLI program that scans a local directory for images and generates a simple HTML gallery using the experimental CSS Masonry layout. The gallery file generated is left in the directory, so in the future, you can just open it in a browser.

The CSS Masonry option does a great job of using up all of the available space in the window. It also works well with browser scaling/zooming. I like the experience of browsing images this way much more than the default Windows file explorer with the "Extra large icons" view mode.

Features

  • Generate a minified HTML gallery with a masonry layout
  • Randomize the order of the images
  • Select and filter a subset of the images

Example output

View the example-gallery in GitHub Pages. Note the small icons on the top-right. Try clicking on a few images, then clicking the filter button.

Usage

Either grab a binary from a release and add it to your PATH or clone this repo and run go install.

Example with The Works of Zdzisław Beksiński:

PS C:\Users\Dom\Pictures\ZdzislawBeksinski> gall .
2024/04/29 11:40:36 Directory to be scanned: .
2024/04/29 11:40:36 Found 88 images in the directory
2024/04/29 11:40:36 1 non-images were excluded from the gallery
2024/04/29 11:40:36 Gallery created: C:\Users\Dom\Pictures\ZdzislawBeksinski\gal.html

Options

gall ./some-dir  	# Generate default gallery in directory
gall ./some-dir -f 	# launch with firefox
gall ./some-dir -b 	# launch default browser

Enabling CSS Masonry in Firefox

At the time of writing this, to use the Masonry layout in Firefox, navigate to about:config and set layout.css.grid-template-masonry-value.enabled to true.

Notes

Example gallery images generated with https://unsample.net/

Template Placeholders

The file template.html contains the unminified HTML template of the gallery page with a bit of CSS and JavaScript. This app simply loads that file and replaces the below placeholders with some text and HTML.

Placeholder Content
<!-- GALLERY_CONTENTS --> Gallery images
<!-- GALLERY_TITLE --> Gallery title
<!-- GALLERY_INFO --> Gallery info

Context Menu (Windows)

To make this app a bit easier to use on my Windows 11 machine, I added it as an option to my context menu when right clicking a folder or the background pane of an open folder. This is what it looks like:

This uses a tool called Nilesoft Shell. Once installed, simply add the following to your shell.nss:

menu(type='back|dir' mode="multiple"  title='dominickp/gall' image=\uE1F4)
{
	item(title = 'Generate Gallery' cmd='gall' arg='.')
	item(title = 'Generate Gallery (launch Firefox)' cmd='gall' arg='. -f')
}

gall's People

Contributors

dominickp avatar

Stargazers

Aaron LEE K.S. avatar blurk avatar Jessica Barnett avatar Mohamed Ted Meftah avatar Václav Vančura avatar Jose C Luna avatar Tom avatar gokacinlar avatar Aline Bevilacqua avatar Michel avatar hyrious avatar win avatar sugar avatar Michael S. Manley avatar Ossama Zaid avatar Arif Datoo avatar Sean Goresht avatar Christian Boyle avatar Tao Zhang avatar  avatar joachim kliemann avatar Steve Farmer avatar Clayton Kehoe avatar dai avatar Arran France avatar rusty kay avatar

Watchers

情封 avatar  avatar

Forkers

leffen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.