title Building a Gallery user mrwerewolf ip 66.156.3.48 vol 1 lock ******** My current side project has been to create a replacement for my old python gallery scripts that have grown a little stale and are hard to modify. I decided to use PHP since my server is optimized to serve it as fast-cgi, PHP is deployed on more web servers than python, and I wanted to learn PHP. Dependencies: /list( * PHP 5.2.x and higher * Cache_Lite 1.7.2 and higher (lower versions might work) * PEAR - for Cache_Lite * ImageMagick - handles resizing * A web server setup to host php (I use lighttpd) /list) Architectural Requirements: /list( * Easy to setup, modify, add photos, and view * Take advantage of screen space when possible * No database setup (BerkleyDB is a possible future solution for things that may require a database) * No frames (they're just annoying) * Files written by the script must be kept out of the gallery folder (wasn't true in the old script) /list) Current Features: /list( * Just upload a folder with pictures in it and point the script to the folder * Add sub-folders and pictures to expand the gallery * Thumbnails and several picture sizes are automatically generated * Most of the gallery is cached for speed * Supports very large amounts of pictures (I have over 500 pics in one folder, and nearly 1000 pics total) /list) Right now my new gallery is good enough to replace my old python script; it currently does everything the python script does, but is better in some areas and the code is much more readable and modifiable. My plans for the future of the project is to build a client side viewer with the Google Web Toolkit (gwt) and use the PHP script to handle the remote procedure calls (rpc) by the gwt client. I'm hoping to gain more freedom in my layout in this manor, and a little boost in speed as the client does some of the processing. I also want to build a way for viewers to post comments on pictures in the gallery, and administrative tools to handle them as well as a way to add info to a picture like who took the picture, where it was taken, a little note about the picture, etc. A current deployed version of my php gallery is here: http://mrwerewolf.com/Gallery.php SNAPSHOT-2007-03-22 * /file Gallery.php * /file style.css If you want to setup your own gallery, download the snapshot and upload it to your server where your normally put your pages. Make sure you meet all the dependency requirements described above. If you do not have the dependencies and you are the administrator of your server, then here is how you install them. For Fedora Core do the following: /box( /pre( FedoraCore: sudo yum install php php-pear ImageMagick FedoraCore: sudo pear install Cache_Lite /pre) /box) note: make sure you type in ImageMagick, as it is case sensitive. For Ubuntu do the following: /box( /pre( Ubuntu: sudo apt-get install php5 php-pear php-cache-lite imagemagick /pre) /box) To setup your web server with PHP, refer to the documentation specific to the web server that you are using. After you have all the dependencies, all you have to do is create two folders. From the directory where you placed Gallery.php, create a folder named "Gallery" (case sensitive) and a folder named "tmp". Then change the properties of the "tmp" folder to allow anyone to write to it. On the command line: /box( /pre( any: mkdir Gallery any: mkdir tmp any: chmod 777 tmp /pre) /box) That should be it. Now all you have to do is add pictures to the "Gallery" folder and then point your browser to the "Gallery.php"