<commit_before># Edegal - A web picture gallery

[![Build Status](https://travis-ci.org/japsu/edegal-express.png)](https://travis-ci.org/japsu/edegal-express)

Edegal is a web picture gallery written in Node.js and designed with performance and scalability in mind.

High performance is achieved through the usage of a dead simple REST JSON API in which most cache misses only result in a single database query that returns a single document.

Edegal is a work in progress. See a demo at [uusi.kuvat.aniki.fi](http://uusi.kuvat.aniki.fi/) or [gallery.insomnia.fi](http://gallery.insomnia.fi).

## Goals

* Successfully replace Coppermine Image Gallery at [kuvat.aniki.fi](http://kuvat.aniki.fi)
  * 49,860 files in 619 albums and 110 categories viewed 6,118,935 times over the course of 9 years (as of 22nd June 2013)
* Provide picture galleries for the members of [Kapsi Internet-käyttäjät ry](http://www.kapsi.fi) requestable via a web self-service portal
* Drop some jaws with stunning visuals and flawless usability
* Become the number one choice for a self-hosted image gallery for serious hobbyist photographers

## Getting started

What is assumed:

* An UNIX-like operating system such as Ubuntu, CentOS or Mac OS X
* MongoDB installed and configured.
  * If you need to authenticate to MongoDB, edit `server_config.json`. The format is `mongo://user:password@localhost/edegal`).
  * By default, the database names used are `edegal` and `edegal_test` (for running tests).
* ImageMagick
* NodeJS (0.10.x) and NPM

Running a local server:

    # install dependencies and build
    npm install

    # run server
    npm start

    # enjoy
    iexplore http://localhost:3000

Development:

    # install development tools into PATH
    npm -g install gulp

    # do an un-minified debug build, run a development server and watch for changes
    gulp

    # do a minified production build
    NODE_ENV=production gulp build

    # run tests
    npm test

## Getting pictures into the gallery

Sorry, this is a bit technical at the moment. There will be a browser-based uploader. Some day. I think.

At this moment you need to import album at a time. First, put the pictures somewhere under the document root. Let's assume `public/pictures/my-new-album`.

    # (If you havent yet created the root album - do this only once)
    bin/edegal setup --title "My Photo Gallery"

    # Create an album
    bin/edegal album create --title "My New Album" --parent /

    # Import some photos
    bin/edegal import --move --path /my-new-album /path/to/files/*.jpg

You're all set!

## Configuration

There are configuration files for client and server, `client_config.json` and `server_config.json`.

### Client configuration (`client_config.json`)

Changing any values in `client_config.json` requires recompilation (`NODE_ENV=production gulp build`).

* `defaultLanguage`: `en` and `fi` supported.
* `analyticsAccount`: Put your Analytics token here to enable [Google Analytics](https://analytics.google.com) support.

### Server configuration (`server_config.json`)

* `database`: as accepted by `mongoose.connect`
* `port`: port number to listen on
* `hostname`: hostname or IP address to listen on
* `concurrency`: how many pictures to scale concurrently
* `sizes`: default preview sizes
  * `width`<commit_msg>README: new importer copies/moves, no longer need to be under docroot<commit_after># Edegal - A web picture gallery

[![Build Status](https://travis-ci.org/japsu/edegal-express.png)](https://travis-ci.org/japsu/edegal-express)

Edegal is a web picture gallery written in Node.js and designed with performance and scalability in mind.

High performance is achieved through the usage of a dead simple REST JSON API in which most cache misses only result in a single database query that returns a single document.

Edegal is a work in progress. See a demo at [uusi.kuvat.aniki.fi](http://uusi.kuvat.aniki.fi/) or [gallery.insomnia.fi](http://gallery.insomnia.fi).

## Goals

* Successfully replace Coppermine Image Gallery at [kuvat.aniki.fi](http://kuvat.aniki.fi)
  * 49,860 files in 619 albums and 110 categories viewed 6,118,935 times over the course of 9 years (as of 22nd June 2013)
* Provide picture galleries for the members of [Kapsi Internet-käyttäjät ry](http://www.kapsi.fi) requestable via a web self-service portal
* Drop some jaws with stunning visuals and flawless usability
* Become the number one choice for a self-hosted image gallery for serious hobbyist photographers

## Getting started

What is assumed:

* An UNIX-like operating system such as Ubuntu, CentOS or Mac OS X
* MongoDB installed and configured.
  * If you need to authenticate to MongoDB, edit `server_config.json`. The format is `mongo://user:password@localhost/edegal`).
  * By default, the database names used are `edegal` and `edegal_test` (for running tests).
* ImageMagick
* NodeJS (0.10.x) and NPM

Running a local server:

    # install dependencies and build
    npm install

    # run server
    npm start

    # enjoy
    iexplore http://localhost:3000

Development:

    # install development tools into PATH
    npm -g install gulp

    # do an un-minified debug build, run a development server and watch for changes
    gulp

    # do a minified production build
    NODE_ENV=production gulp build

    # run tests
    npm test

## Getting pictures into the gallery

Sorry, this is a bit technical at the moment. There will be a browser-based uploader. Some day. I think.

At this moment you need to import album at a time.

    # (If you havent yet created the root album - do this only once)
    bin/edegal setup --title "My Photo Gallery"

    # Create an album
    bin/edegal album create --title "My New Album" --parent /

    # Import some photos
    bin/edegal import --move --path /my-new-album /path/to/files/*.jpg

You're all set!

## Configuration

There are configuration files for client and server, `client_config.json` and `server_config.json`.

### Client configuration (`client_config.json`)

Changing any values in `client_config.json` requires recompilation (`NODE_ENV=production gulp build`).

* `defaultLanguage`: `en` and `fi` supported.
* `analyticsAccount`: Put your Analytics token here to enable [Google Analytics](https://analytics.google.com) support.

### Server configuration (`server_config.json`)

* `database`: as accepted by `mongoose.connect`
* `port`: port number to listen on
* `hostname`: hostname or IP address to listen on
* `concurrency`: how many pictures to scale concurrently
* `sizes`: default preview sizes
  * `width`
{'fraction_non_alphanumeric': 0.08721461187214612, 'fraction_numerical': 0.009741248097412482, 'mean_word_length': 3.8818722139673105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3415842', 'n_tokens_mistral': 2043, 'n_tokens_neox': 1868, 'n_words': 809}