image gallery source code
My image gallery uses the following ad-hock components:
On the server side, some php:
- index.phps (only file you should need to edit)
- Gallery.class.phps
- Album.class.phps
- albums.phps
- black.css
On the client side, 2 scripts:
Dump the scripts in ~bin on some machine that has your photos and imagemagick installed. Edit update to point to your photos. I’m expecting something like this:
/some/path/photos
within photos:
fargo_trip/*.jpg
duluth_trip/*jpg
update will run through each one of these dirs and create thumbnails and medium sized images for display. It’ll throw thumbs in a ‘thumbs’ directory, images with a max size of 500×500 pixels in a ‘5max’ directory, and throw the original files in an ‘orig’ directory. If you re-run update, it’ll just touch add any additional jpgs it finds in the album directory to ‘orig’ and create thumbs and medium sized images.
for typical usage, i expect this is about all you’ll need to know. in my situation, however (constantly evolving, too), i have a high-bandwidth server with low storage capacity (we’ll call this nonninja) and a low-bandwidth server with high storage capacity (we’ll call this gridley). for this reason, i use rsync to send the contents photo albums tree with just the 5max and thumbs directories to nonninja and send just the orig directories to gridley. I expect that this is not the most common case, so just set the variable $rweb_root to be the same as $web_root in the index.php file found above.
my rsync commands ( were in crontab until i realized they were making my raid fail ):
rsync –delete -rtve ssh –exclude-from=/…/gridley.exclude /…/photos/ gridley.example.com:~/…/photos > /…/gridley.log
where the contents of gridley.exclude is:
# gridley.exclude
# don’t send thumbnails or 5max to gridley. just send originals
*/thumbs
*/5max
nonninja gets the same basic format except different exclude file (contains ‘*/orig’) and a different hostname.
happy imaging. post a comment or send me email if these instructions hose your system.
