Skip to main content

ggallery

npm

ggallery is a Python tool that generates a static HTML photo gallery website from a YAML specification and from given renderer plugin. It allows you to create beautiful and customizable photo galleries with ease, using various data sources and storage providers.

Features

  • Static HTML Generation using plugins: Create a static HTML photo gallery that can be hosted on any web server, using a custom renderer plugin.
  • Multiple Data Sources: Supports local file system and Azure Blob Storage as data sources.
  • Thumbnail Generation: Automatically generate thumbnails for your images.
  • Docker image creation: Create a Docker image (using nginx) with the generated gallery.

Available Renderer Plugins

Usage

To install ggallery, you need to have Python with pip package manager in your system. Then you can install the tool using the following command:

pip install ggallery

You can run the ggallery using the following commands:

python -m ggallery -f /path/to/your/gallery.yaml

or

ggallery -f /path/to/your/gallery.yaml

If you have the gallery.yaml file in the current directory, you can run the tool without specifying the file path:

ggallery

Photos and HTML files are stored in the same directory as the static website. It will procude a directory ready to be served by a web server.

  1. Set environment variables (or create .env file)
  • LOCAL_PHOTOS_PATH: Path to the directory containing photos.
  • DOCKER_HOST Hostname of the Docker host. (e.g tcp://localhost:2375)
  1. Create a gallery.yaml file with the following content:
title: Local Gallery
subtitle: Gallery with photos stored in the same directory as static website.

thumbnail:
    height: 400

template:
    url: https://github.com/creeston/ggallery-nanogallery2

data_source:
    type: local
    path: "${LOCAL_PHOTOS_PATH}" # Path to the directory containing photos.

data_storage:
    type: local # Store photos in the same directory as the static website.

albums:
    - title: "Japan"
      subtitle: "Photos from my trip to Japan"
      source: "japan"
      cover: "view on the Fuji.jpg"

    - title: "Italy"
      source: "italy"
      cover: "colliseum.jpg"
      photos:
          - title: "View at the Colosseum at night"
            source: "colliseum.jpg"

# Output directory for the generated gallery website.
output:
    path: docs
    index: index.html

# Docker image configuration
docker:
    image_name: "username/my-photo-gallery"
    image_version: "latest"
    host: "${DOCKER_HOST}"

Azure Blob Storage Example

Photos are stored in Azure Blob Storage. The generated gallery will contain links to the photos stored in Azure Blob Storage.

  1. Set environment variables (or create .env file)
  • LOCAL_PHOTOS_PATH: Path to the directory containing photos.
  • AZURE_CONTAINER: Azure Blob Storage container name.
  • AZURE_CONNECTION_STRING: Azure Blob Storage connection string.
  1. Create a gallery.yaml file with the following content:
title: Azure Gallery
subtitle: Gallery of photos stored in Azure Blob Storage

favicon:
    type: fontawesome
    name: camera-retro

thumbnail:
    height: 400

template:
    url: https://github.com/creeston/ggallery-nanogallery2

data_source:
    type: local
    path: "${LOCAL_PHOTOS_PATH}"

# Azure Blob Storage configuration, used to store photos and thumbnails.
data_storage:
    type: azure-blob
    container: "${AZURE_CONTAINER}"
    connection_string: "${AZURE_CONNECTION_STRING}"

albums:
    - title: "Japan"
      subtitle: "Photos from my trip to Japan"
      source: "japan"
      cover: "view on the Fuji.jpg"

    - title: "Italy"
      source: "italy"
      cover: "colliseum.jpg"
      photos:
          - title: "View at the Colosseum at night"
            source: "colliseum.jpg"

output:
    path: docs
    index: index.html

Implementing a Custom Template

ggallery doesn't contain any templates by default. You can create your own plugin by implementing ggalllery.renderers.BaseRenderer class. The plugin can be stored either locally or in a public github repository. URL to the repository should be provided in the gallery.yaml file in the template.url field.

Examples:

Contribution

Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for ggallery 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ggallery 1.1.3
File Size Uploaded
ggallery-1.1.3.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ggallery 1.1.3
File Interpreter ABI Platform
ggallery-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 36.8 kB

Release files / ggallery-1.1.3.tar.gz

Download URL ggallery-1.1.3.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ddbc38d398cb1ce67f380e7ec5bad96d874d4451257697e4334875eb65075fdd
BLAKE2b-256 checksum
How to use checksums
0383e04e9a2b030192d134682ce0cce57767a5a7ee2b9a4d9761847734b7a60b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release files / ggallery-1.1.3-py3-none-any.whl

Download URL ggallery-1.1.3-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
305e9ccfa12e04e491138046f728e76e10cb64f7583c3dbadf351a67318daa3e
BLAKE2b-256 checksum
How to use checksums
c1564191cb1890b88cbf256f80dbfb3e896dbad590c27186bb6056f75e988f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release history Release notifications | RSS feed

This release

1.1.3 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page