Skip to main content

Add your description here

Project description

ggallery

npm 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

Gallery Specification Examples

Local Gallery with Docker Image

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:

Live Gallery Examples

References

ggallery uses the following technologies:

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.

Development

To set up a development environment, create a virtual environment and install the required packages:

  1. Install uv and pip if you haven't already. (https://github.com/astral-sh/uv)

  2. Install dependencies using uv:

uv sync

Build

python -m build

Update PyPI

python -m twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ggallery-1.1.2.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ggallery-1.1.2-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file ggallery-1.1.2.tar.gz.

File metadata

  • Download URL: ggallery-1.1.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for ggallery-1.1.2.tar.gz
Algorithm Hash digest
SHA256 ac9a63e9d215f8a97464c3778c119430b851edc2fb9eac61b8ddafd93ef87454
MD5 330269d4afeecc26371e65b8703296ca
BLAKE2b-256 62ec268c1345b87ed2893f0d35e2a174b3c7d591810f44f9794a5f16375bb8a8

See more details on using hashes here.

File details

Details for the file ggallery-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: ggallery-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for ggallery-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 89d2526cb2a8ae6800cd4a6e7d89e30a2915a2ee41bd11e03207f99e73ea91e3
MD5 fa66362962619048d81e897d3eed4422
BLAKE2b-256 2b9e483d14ae11f7bc8950a7086f967e612216cce35065fd24ccfebda9cab279

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page