PHP Gallery 2 for Picture Storage and Simple Document Management

What is PHP Gallery 2?

PHP Gallery 2 is a web-based management system for storing pictures and other documents such as movies and flash files. While it is not designed for storing documents such as Microsoft Word or PDF, it serves as a simple storage container for those as well and will even automatically create thumbnails for PDFs if you have ImageMagick installed. It is similar to Gallery 1 except unlike Gallery 1, the meta data of documents is stored in a database as opposed to the file system. Documents are still stored in the file system. Gallery is Open Source software licensed under GPL. Details here.

We've been using Gallery 2 for various projects over the past year or so because it has been fairly easy to integrate into our PHP applications. Below is the list of features we like most about it:

  1. Supports one of our favorite databases and those other 2 - PostgreSQL, MySQL, Oracle. Minor gripe - you can tell from the docs that there is a MySQL bias.
  2. Cross-Platform - will work anywhere PHP works.
  3. It uses PHP ADODB as the database abstraction layer.
  4. It uses Smarty Templating engine.
  5. Lots of Plugins to choose from - we'll go over our favorites later
  6. When you upload a high-res image it automatically creates 2 other sizes (thumbnail and regular web view)

People may ask when you've got Flickr and Picasa and all that other stuff, why would you ever go with Gallery 2. We haven't tried Flickr or those others, so we can't really speak of their merits or downfalls, but the reasons we prefer Gallery 2 over those other options is the same reason we prefer Serendipity Blogging engine over something like Google Blogger. We have more control, more seamless integration with our other database applications, and if you loose internet connection and are running an intranet, you are not out of luck.

Gallery 2 Gotchas when using PostgreSQL: Case Sensitivity when doing Search

Gallery 2 for our purposes has performed very nicely with PostgreSQL except for case-sensitivity when doing searches. People must think we are broken records by now. Here is a fine occasion where the case-sensitivity of PostgreSQL and as I recall Oracle - bites you. We have come up with 2 ways of overcoming this obstacle.

  1. Make PostgreSQL non-case sensitive - this we outlined in Using MS Access with PostgreSQL
  2. Make Gallery 2 compensate for Case Sensitivity - Hack the /modules/core/classes/GalleryCoreSearch.class -> search as described in this thread we posted to

Cool Plugins

A lot of the plugins require the following Graphics Toolkits

Below are some of our highly recommended Plug-ins in addition to the Graphics Toolkits and pre-installed:

  1. Cart and Zip Download: Makes it easy for users to pick pictures they want and download High-Res versions
  2. Keyword Album: Allows you to have dynamic albums created based on Keywords you type in
  3. Flash Video, MP3 Audio: Allows these to be played right on the page and for Flash set the desired size
  4. Archive Upload: Allows uploading zip files and having them explode into albums and album items
  5. Numerous other upload plugins: XP Upload (for uploading from Windows XP Explorer), Picasa, etc.
  6. Javascript Slideshow