Web Photo Gallery

Every now and then I repeatedly come to question myself, which web-based photo gallery to choose for personal photo distribution.

There seems to be an abundance of choices, but unfortunately, it is not trivial to satisfy my requirements:

  1. I do not want to „upload“ my pictures. They are already residing on my file server, so why touch and copy them again? (sub-requirement: the gallery should not require more than read-only access to the image data.)
  2. I want to drive my internal as my external web server with the same images, and co-existent.
  3. I want to keep user management as simple as possible.
  4. CPU and memory requirements should be low.

So, which gallery to choose?

Obvious Choices

The omnipresent solutions are Gallery2 and Coppermine.

Both don’t satisfy requirement 1, they require explicit uploading.

Trying to run Gallery2 according to requirement 2, driving it in parallel on two machines, drove me crazy, but didn’t succeed for Gallery2.

Neither Gallery2 nor Coppermine are able to employ LDAP authentication, so requirement 3, easy user management, wasn’t fulfilled either.

Can’t really tell about memory requirements, but the killer problem always seems to be generation of thumbnails on demand.

Obviously, both choices wouldn’t suffice.

Emerging Option

While stumbling over updates of BLOG:CMS I incidentally found Singapore.

That was the only choice which fulfilled my requirement 1, the no-upload, which made it an automatic winner.

Though, the project looked pretty dead, as the last „beta“ realease was from 2004. But, there are new release candidates in 2006 so at least someone is thinking about it, which makes Singapore a viable option to test.

Directory Setup

Setting it up and testing was a breeze, though it requires directories to have either pictures or directories, but can’t display pictures in directories with sub-directorires. That required some directory-creation and file-moving, but, alas, the structure was right.

By design some directories on my file server have mode 700, hence not readable by anyone than me. Unfortunately, the fopen function of Singapore throws errors by this, and displays the directory. Fiddling with PHP options to have display_errors=off in php.ini took another while, but should have been right anyway.

Interestingly, Singapore can store it’s data either in files in the file system, within a file-based SQLite database, or within a MySQL server.

First test was with Singapore configured to use the file system for its metadata. Unfortunately, it writes its metadata into the same directory as the pictures, which I very much dislike. Not only does it pollute the directory, burned by fire in the past I strongly dislike any management software having write access to my important data.

Switching configuration from file storage to SQLite was easy and worked out of the box. Migration of configuration data is not supported though, metadata modifications made had to be redone.

Parallel Installation

Now the test for requirement 2, parallel installation. Interestingly enough, it didn’t work for SQLite-based configuration. The second server importing the directory via NFS just hang.

Hence I gave MySQL-based config a try, but the installer consistently refused to use the user account I gave in the configuration files and so was unable to create the required tables in my database server.

Switching back to file system-based metadata storage then worked immediately! Yeah!

Metadata Outside Image Directory

I made a hack to calculate a different path for meta data storage in includes/io_csv.class.php, namely „$data_dir/metadata/“:

class sgIO_csv extends sgIO
{
/* (doc-t-yoh)
* this function returns name of metadata file for a gallery
*/
function getGalleryMetadataFilename($gallery,$language=null) {
$fn = str_replace(„/“,“_“,$gallery->id);
$fn = ereg_replace(„^[\./_]*“, „“, $fn);
$fn = $this->config->base_path.$this->config->pathto_data_dir.“metadata/“.$f
n;
if($language != null) {
$fn = $fn . „-“ . $language;
}
$fn = $fn . „.csv“;
return $fn;
}

and call it appropriately:

function getGallery($galleryId, $language = null, $getChildGalleries = 1)
{
$gal = new sgGallery($galleryId);

if($language == null) $language = $this->config->default_language;

//try to open language specific metadata
// (doc-t-yoh)
// $fp = @fopen($this->config->base_path.$this->config->pathto_galleries.$ga
lleryId.“/metadata.$language.csv“,“r“);
$fp = @fopen($this->getGalleryMetadataFilename(&$gal,$language),“r“);
//if fail then try to open generic metadata
if(!$fp) {
// $fp = @fopen($this->config->base_path.$this->config->pathto_galleries.$
galleryId.“/metadata.csv“,“r“);
$fp = @fopen($this->getGalleryMetadataFilename($gal),“r“);
}
if($fp) {

and

function putGallery($gallery) {

// (doc-t-yoh)
// $fp = fopen($this->config->base_path.$this->config->pathto_galleries.$gal
lery->id.“/metadata.csv“,“w“);
$fp = fopen($this->getGalleryMetadataFilename($gallery),“w“);

if(!$fp)
return false;

// (doc-t-yoh)
// fixed a typo: catergories -> categories
// $success = (bool) fwrite($fp,“filename,thumbnail,owner,group(s),permissi
ons,catergories,image name,artist name,artist email,copyright,image description,
image location,date taken,camera info,lens info,film info,darkroom manipulation,
digital manipulation“);
$success = (bool) fwrite($fp,“filename,thumbnail,owner,group(s),permissions
,categories,image name,artist name,artist email,copyright,image description,imag
e location,date taken,camera info,lens info,film info,darkroom manipulation,digi
tal manipulation“);
$success &= (bool) fwrite($fp,“\n\““.

(also fixes a typo)

Don’t forget to create the „metadata/“ directory and to assign the user the web server is running as write permission.

User Management

Well, as usual, has it’s own user management which I don’t want. So, everthing is open and readable by default, and protected by an appropriate .htaccess file authenticating against LDAP. guest user is disable so to not allow uploading of pictures.

CPU and Memory Utilization

That’s hard, as thumbnail generation and resizing kills my poor machine, but there is nothing I can do. Well, the software could pre-generate thumbnails and resized images, but doesn’t. Other galleries do it upon uploading, which I don’t want, but why not during idle times in the background?

Thumbnails of one template doesn’t fit for another, so they have to be re-rendered for each template, which hogs precious CPU and memory. Not nice and could be done better.

Drawbacks

  • Singapore can either re-render images to fit to the template requirements (which also doesn’t work for the MinimalBlue template: pictures are extending across the right side of the frame), or to display images at their full size, which blows the design and usability completely. It is not possible to have both options at the same time. That’s sad, because it should be easy to display a reduced version until the user demands the original photo. Gallery2 can do that.
  • No LDAP user management. Why, oh, why is that not a standard in all projects?
  • Ill-maintained project.
  • Templates are workable at best, but not very nice.
  • Own hacks will break with update.

Solution

Singapore with own hacks for file system-based metadata management in own directory. Authentication and autorization based on LDAP-based .htaccess file. Good enough for me.

Advertisements
Both comments and trackbacks are currently closed.
%d Bloggern gefällt das: