gollery

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 27 Imported by: 1

README

gollery

A simple web gallery written in golang for serving images

Features

  • create different image sizes (thumbnail / preview / future: mobile) using imagemagick
  • watch image folders and create images automatically
  • serve a site for every gallery
  • responsive masonry layout
  • create zip with all images
  • custom css for every gallery

alt text

Installation

Prerequisites

For creating thumbnails & previews gollery uses imagemagick. Please install a suitable imagemagick version for your os and make sure it's reachable via convert or magick.

Download imagemagick

Build from source
  1. clone the github repo
  2. make install
  3. make build
  4. there should be a application in your $GOPATH/bin called gollery
Download binaries

// Provide binaries for linux & windows in the future

Usage

CLI

Gollery comes with a simple cli and 3 basic commands:

  1. gollery start

    This command starts the webserver and the filewatcher.

  2. gollery init

    This command creates a new root folder with a config.yaml and a example gallery

  3. gollery new

    This command creates a new gallery within an existing config.yaml and adds it to the config.

  4. gollery remove

    This command removes a gallery from an existing config.yaml and deletes the folder structure.

The folder of the config.yaml and the galleries can be provided manual with gollery -c /PATH/TO/GOLLERY/ COMMAND. This is possible with all commands. Check the help for further options.

Docker

There's the possibility to build gollery within a docker container. At the moment you still need to create a config with the binary or by hand outside the container.

make build-docker docker run -p 8080:8080 -v /PATH/TO/GALLERY/FOLDER:/gollery --name gollery gollery

Documentation

Overview

Package gollery - main package of the application with all the logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CliAccess

func CliAccess()

CliAccess - Main function for all functionality provides all cli arguments via cli plugin - read doc for more information

Types

type Config

type Config struct {
	Port      string
	SSL       bool
	Cert      string
	Key       string
	Galleries map[string]*Gallery
}

Config Struct for the config.yaml with Port and all the galleries.

var (
	// GlobConfig contains the read config from the config.yaml
	GlobConfig Config
)

func ReadConfig

func ReadConfig(f string, initialize bool) Config

ReadConfig - Checks whether provided config path is valid Read & unmarshal config.yaml Call initImages for all galleries from the config file

type Gallery struct {
	Title       string
	Description string
	Download    bool
	CustomCss   bool
	Sort        bool
	Images      []Image `yaml:"-"`
	Dir         dir     `yaml:"-"`
}

Gallery Struct for a gallery within the config struct. Images and Dir are not in the config.yaml - recreated on every program start

type Image

type Image struct {
	Name    string
	Date    string
	Time    time.Time
	Ratio   float32
	Feature bool
}

Image Struct for image within gallery struct.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL