npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

n-gallery

v0.4.2

Published

A nodejs web image viewer/gallery using local image directory

Downloads

3

Readme

N-Gallery

A web photo gallery and picture viewer/browser using local image directory, powered by Node.js (Demo Website )
(中文文档见下文)

Features

  1. List pictures of a gallery fast and with beautiful web page
  2. List galleries in the same local directory in one web page
  3. If multiple directories specified, galleries in these directories are merged to diaplay in one web page
  4. Some operations to images or galleries are supported

Select images or galleries
Select All
Cancel Select All
Reverse Selected
Delete Selected (move mode and delete mode are supported)
Show image properties

  1. Breadcrumb navigation is supported for the deep gallery path
  2. Dynamically set or add the gallery directories
  3. Zome in/out to display images
  4. Smooth experience

Quick Start

Install

$ npm install n-gallery -g

Run

Use the album_base_dirs argument in the configuration file(see blow) as base image directories by default

$ n-gallery

Specify image directories

$ n-gallery /tmp/pic/G1 /tmp/pic/G2

Specify image directories which are listed in a file, per directory name per line

$ n-gallery --file=/tmp/pic/img-dirs.txt
or
$ n-gallery -f /tmp/pic/img-dirs.txt

// /tmp/pic/img-dirs.txt
/tmp/pic/G1
/tmp/pic/G2
/tmp/pic/G3

Open generated website in default browser immediately. -b should be specified at last

$ n-gallery /tmp/pic/G1 -b

If you don't want to use the global n-gallery command to run, you can use index.js as the program entry. For example

n-gallery_home_path$ node index.js
n-gallery_home_path$ supervisor index.js

Configuration

In the lib/config/config.js file, you can specify the server port number, image directory and so on. album_base_dirs must be specified for image directories unless you specify it from terminal command everry time

// lib/config/config.js
...
album_base_dirs: ["/tmp/gallery1, /tmp/gallery2"],
// If not set, will guess by the "Accept-Language" header field by default
// Only Chinese and English are supported now, and you can add a language file in the `doc/locales`
lang: 'en',
  
// Only IP in this list is allowed to do some operation on the images such as delete images
// or change image directory
ip_white_list: ['127.0.0.1'],

// del => delete files directly, mv => move files to a temporary directory 
delete_mode: 'mv',
  
// when delete mode is 'mv'
tmp_dir: '/tmp/n-gallery', 
  
// product, dev
env: 'product'
...

How to Use

If specified directory has subfolders (galleries), webpage is shown as blow. Every element represents a subfolder (gallery). Click the Start MultiSelect on the right top of the web to start multiselect mode

Select

Delete the images in the selected subfolders

Delete selected

If specified directory doesn't have subfolders, so a gallery is displayed directly

gallery

N-Gallery

一个基于Node.js的网页图片浏览器,利用本地图片文件夹生成网页 (示例网站)

特性

  1. List pictures of a gallery fast and with beautiful web page
  2. List galleries in the same local directory in one web page
  3. If multiple directories specified, galleries in these directories are merged to diaplay in one web page
  4. Some operations to images or galleries are supported

Select images or galleries
Select All
Cancel Select All
Reverse Selected
Delete Selected (move mode and delete mode are supported)
Show image properties

  1. Breadcrumb navigation is supported for the deep gallery path
  2. Dynamically set or add the gallery directories
  3. Zome in/out to display images
  4. Smooth experience

快速向导

安装

$ npm install n-gallery -g

运行

默认情况下,读取配置文件(参见下文)中album_base_dirs参数指定的目录作为图片文件夹生成网页

$ n-gallery

指定图片目录

$ n-gallery /tmp/pic/G1 /tmp/pic/G2

通过配置文件的方式指定图片目录,一行一个目录

$ n-gallery --file=/tmp/pic/img-dirs.txt
或者
$ n-gallery -f /tmp/pic/img-dirs.txt

// /tmp/pic/img-dirs.txt
/tmp/pic/G1
/tmp/pic/G2
/tmp/pic/G3

在输入完命令后,马上在默认浏览器中运行生成的网页。-b 参数应该在命令的最后指定

$ n-gallery /tmp/pic/G1 -b

If you don't want to use the global n-gallery command to run, you can use index.js as the program entry. For example 如果不想使用全局的n-gallery命令运行程序,可以用index.js作为程序入口,例如

n-gallery_home_path$ node index.js
n-gallery_home_path$ supervisor index.js

配置

lib/config/config.js文件里,可以设置端口号、图片目录等。其中album_base_dirs必须设置,除非每次在终端运行命令的时候用参数指定

// lib/config/config.js
...
album_base_dirs: ["/tmp/gallery1, /tmp/gallery2"],
// 如果不设置,默认根据HTTP header中的『accept-language』来判断所使用的语言(只支持中文和英文 => zh, en)
// 可以在`doc/locales`中自己添加语言支持
lang: 'zh',
  
// 对于一些操作,如删除,更改图片目录等,只有在白名单中的IP才可以执行
ip_white_list: ['127.0.0.1'],

// del => 直接删除文件, mv => 将文件移到一个指定的临时文件夹下而不删除 
delete_mode: 'mv',
  
// mv模式下,指定的临时文件夹
tmp_dir: '/tmp/n-gallery', 
  
// product, dev
env: 'product'
...

使用教程

如果指定的目录中含子目录,那么网页的显示如下,每个元素都是一个子文件夹(相册)。点击右上角的启动多选模式以便可以进行多选,默认单击子文件夹的图片时在新窗口打开以该子文件夹为根目录的相册

Select

删除选中的子文件夹中图片

Delete selected

如果指定的目录中不含子目录,那么该页面就是一个相册

gallery