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:
- 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.
- Cross-Platform - will work anywhere PHP works.
- It uses PHP ADODB as the database abstraction layer.
- It uses Smarty Templating engine.
- Lots of Plugins to choose from - we'll go over our favorites later
- 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.
- Make PostgreSQL non-case sensitive - this we outlined in
Using MS Access with PostgreSQL
- Make Gallery 2 compensate for Case Sensitivity - Hack the /modules/core/classes/GalleryCoreSearch.class -> search as described in
this thread we posted to http://gallery.menalto.com/node/18076
A lot of the plugins require the following Graphics Toolkits
- Image Magick which has binaries available for Unix, Windows and Mac OSX. Image Magick is
a very cool free open source graphics package that can be used within PHP, .NET, Perl etc. It resizes images, flips them, removes EXIFs, convert in-between various formats, even deals with CMYK images. Very cool. If you haven't used it and do a lot of graphical manipulation in your applications, I highly suggest you look into the 100s of features it offers.
- FFMPEG is used by Gallery for doing things like putting water marks on MPEG files and other MPEG manipulation
- Zip/Unzip is used by the shopping cart feature to allow a user to download a whole album or selected documents as a zip and the unzip is used by Gallery upload to allow a user to upload a batch of documents as a single zip that are then extracted. Each folder in the zip becomes a sub album. Linux/Unix machines already have this pre-installed. For windows users you'll need cygwin1.dll and the zip and unzip.exe that come with cygwin
Below are some of our highly recommended Plug-ins in addition to the Graphics Toolkits and pre-installed:
- Cart and Zip Download: Makes it easy for users to pick pictures they want and download High-Res versions
- Keyword Album: Allows you to have dynamic albums created based on Keywords you type in
- Flash Video, MP3 Audio: Allows these to be played right on the page and for Flash set the desired size
- Archive Upload: Allows uploading zip files and having them explode into albums and album items
- Numerous other upload plugins: XP Upload (for uploading from Windows XP Explorer), Picasa, etc.