Recommended PHP photo gallery programs?

software development


Greetings, has anyone got a favourite PHP photo gallery program? One that a PHP newbie will be able to configure fairly easily, and importantly, one that will work correctly with the DH setup? I tried gallery 1.3.4 but had sooo many errors on every page that I abandoned it…

I’m after something that has got some good functionality, and looks good too…

Thanks, Bill


Were you running Gallery as pcgi? IIRC, this is necessary with our setup. See also the kbase article about running PHP as a CGI, and search the archives of this forum. Perhaps someone else will have a suggestion as far as other programs you might check out.

For really barebones photo resizing, I use a Perl script called “mthumbnail” (which uses imagemagick). All it does is make thumbnails and an HTML index, but that works fine for my needs.


I am using Coppermine and like it pretty much. I’m using the previous version but will upgrade when I get around to it. Example.


I vote for Coppermine ( as well. As long as you run it as pcgi (so it can create files–just takes a quick change to the .htaccess file), it installs like a breeze on DreamHost–I probably had it up and running in 10 minutes.

It’s also very nice looking, easy to use, surprisingly powerful, under active development, and looks to be getting better and better.


I use a very simple and straightforard one called PHP Image Gallery ( Example:


Hi, For those interested, this is a script I use all the time for turning a JPG image into a thumbnail. Much better than storing 2 copies of the same thing at different sizes. This works using the GD image library, which is installed on DreamHost servers. Unfortunately, DreamHost have an old version of GD which only supports 256 colour JPGs (new version supports 16 bit colour) but for small thumbs you don’t notice anyway.

To use this script, save the code below as “image.pcgi” somewhere in your main web folder. Then you need to call the script within your HTML like this…

This will resize “images/whatever.jpg” to “100” pixels across the longest side and display at “60%” jpg quality - higher quality images look better but are slower to download.

This script is used extensively on this page - feel free to have a look around and see if it is what you are after. Hope this helps somebody out - I have found it extremely useful :slight_smile:

//////////CODE BELOW - SAVE AS image.pcgi in your main directory

<?php //SET THE DEFAULT VALUES if ($id == "") {$id = "default.jpg";} //FILENAME DEFAULTS TO "default.jpg" if ($sz == "") {$sz = "100";} //SIZE DEFAULTS TO 100 PIXELS if ($ql == "") {$ql = "50";} //QUALITY DEFAULTS TO 50% //DO NOT EDIT BELOW THIS LINE //REMOVES .JPG or .JPEG FROM $ID AND SAVES AS NAMEONLY $pos = strrpos($id, ".jp"); if ($pos === false) { // not found... } else {$nameonly = substr ($id, "0", $pos);} //////////////////////////////////////////////////////// $im = imagecreatefromjpeg("$id"); //DONT FORGET FILE PATH $im_width=imageSX($im); $im_height=imageSY($im); // work out new sizes if($im_width >= $im_height) { $factor = $sz/$im_width; $new_width = $sz; $new_height = $im_height * $factor; } else { $factor = $sz/$im_height; $new_height = $sz; $new_width = $im_width * $factor; } // resize $new_im=ImageCreate($new_width,$new_height); ImageCopyResized($new_im,$im,0,0,0,0,$new_width,$new_height,$im_width,$im_height); // output header("Content-type: image/jpeg"); header( "Content-Disposition: attachment; filename=$nameonly" ); header( "Content-Description: PHP Generated Image" ); Imagejpeg($new_im,'',$ql); // cleanup ImageDestroy($im); ImageDestroy($new_im); ?>


Gallery will give you a bunch of errors when installing but as they say “life is short, let’s move on” or somesuch, do that, move on and it’ll work out fine.

whenyou’re done with the install you’ll need to add a line to the .htaccess file that gallery created:

AddType php-cgi .php

After following all gallery instructions and adding that one line to the .htaccess file you should be good to go. Works under postnuke as a module as well.



If you decide to go with Gallery, you might want to check out my installation notes. I made a short note of every step in installing Gallery 1.3.3 for a DreamHost site. As others have noted here, pay special attention to the steps where you add the “AddType” line to the .htaccess file. This is the part that catches most people.

One additional note I haven’t added to the document yet is that when you see paths like


in the configuration wizard, you should remove the .crypticname part between /home and your username. Like so:


I believe the .crypticname part relates to the fileserver you are on, which might change someday. Beware the future.