Gallery3:Developer Handbook - Gallery Codex
Personal tools

Gallery3:Developer Handbook

From Gallery Codex


Gallery 3 is a simple and powerful web based photo management system that lets you host your photos on your own website. Out of the box it is designed to support the common needs for the common users in a simple, elegant and powerful fashion. In order to be successful this necessarily requires Gallery 3 to be limited in scope and to choose simpler options wherever possible. This approach reduces the amount of code that the small developer team needs to support and increases the rate at which they can produce new versions of the product.

To cope with varying individual needs, Gallery 3 is broadly extensible. Internally it uses a system of modules and themes that can be replaced, extended and added. The goal of Gallery 3 is to make it as easy as possible to add a new feature to the system by creating new modules. At the time of this writing, there are over 100 modules available for Gallery 3.

The goal of this documentation is to explain the fundamentals so that a new developer can create their own features and themes for Gallery 3 and share them with the rest of the community.

Setting up the development environment

To quickly start hacking on Gallery, without installing or configuring any development tools on your system (such as Apache, PHP or MySQL), you can use a prebuilt virtual developer box. It contains all Gallery dependencies and configuration wrapped up in an isolated environment, and works on Linux, Mac and Windows. If this sounds like something you'd want to use, please head over to Using Vagrant to get started.

About This Document

This document contains detailed information and code samples demonstrating how to create modules and themes. In the code samples, the module id will always be example in bold/italics, ie:

 "...create your file in gallery3/modules/example/"
 "...the event helper will be called example_event..."

When you create your own module or theme, replace this with the actual id of your module.

Application Concepts

Design Concepts


  • Life of a Gallery 3 request
  • Security
  • Forms
  • Embedding
  • Loading order
  • Naming Conventions
  • Events
  • Versioning & Upgrading
  • Kohana API
  • G3 API
  • Module Variables
  • Module File Storage
  • Module Hooks - event hooks, rest hooks, search hooks, theme hooks, RSS hooks, task hooks, block hooks,
  • Security
  • Permissions
  • Sanitize
  • Caching -- When to make use of
  • Config Files
  • Directory Layout
  • 3rd Party Libraries
  • Logging & Status Message
  • Batching
  • Tasks
  • Menus
  • Module <--> Module Communication
  • Cloning a Module