Photos on the Web

July 06, 2004

I like taking pictures and sharing them with everyone. While there are problems ''delivering'' large, high quality photos on the Web (bigger = slower), I'm willing to reduce the images to a compromise size.

If I'm going to put a lot of pictures on the Web (as I'd like to), a problem arises in how best to code the web pages. At its simplest, one can link to a folder and let the server present an index of filenames; the visitor would click on one, see the picture, press back for the listing, etc. No coding at all is needed for that; all of the burden is on the visitor.

One can create one or more webpages with the images embedded as they most often are. This also has a benefit of providing descriptions, links, etc. It's not very difficult, but if you want to add images later, you have to add code, too. What I've been looking for and working on for quite a while is a reusable method, something that requires very little change as new pictures are added.

On the one hand, I have looked around the Web; ''why re-invent the wheel?,'' some ask. I have seen a half a dozen or more systems, most of which are free, all of which have limits (of course) and seem larger or more elaborate than necessary. The most recent was one I found at John Fleck's blog. It seemed very promising until I saw all the extra stuff it assumed one's host provides and the absolute absence of documentation.

If I'm going to invest my time in learning something (as I do all the time), I don't want to learn ONE program; I want to learn concepts and techniques that keep going. For an analogy, I'd rather learn how to write than how to use word processing (though one needs to know both). For a Web-based analogy, I'd rather learn HTML than Dreamweaver. The underlying concepts and techniques seem of more lasting value. I learned DOS, instead of some file management utility that no longer exists. </End of nerdy aside>

So, I like to roll-my-own. Turns out that if you DO re-invent the wheel, you really appreciate wheels and all that goes into them.

My latest attempt at a flexible picture presenting mechanism involves a few very small files. Dropped into a folder with pictures, these files will present them. There is a little more to it than that, but most of it involves prepping the pictures, thumbnails and captions -- the core files don't have to change at all. Add images later, and they just work -- no coding. Sweet. I'm not bragging, though I am proud.

The code itself is: HTML (still the foundation everyone should learn), CSS (ditto), a touch of JavaScript (these 3 languages constitute Dynamic HTML -- dHTML), and not all that much PHP.

Let me know if you would like to see the code or discuss any aspect of the process. I'm very interested in other people's thoughts on this topic. You might also compare the new method with the prior one (which used no PHP). mjh

Web entry by mjh at 01:17 PM | email this