zenphoto 0.1 preview
June 4th 2005
I’m not making the source available just yet, but here’s a preview.
Right now, it’s a fully navigable gallery, with full on-the-fly image processing, a simple design using new template functions, display of image and album metadata, and more. Yet to be implemented are the admin interface (which you can’t see anyway ;-)), storing image metadata, comments, cruft-free URLs, and lots of other stuff…
This week, I fully implemented templates, which was big. It’s a simple template system. For example, this is how you print album thumbnails in the gallery index:< ?php while (next_album()): ?>
<a xhref="<?=getAlbumLinkURL();?>" mce_href="< ?=getAlbumLinkURL();?>"
title="< ?=getAlbumTitle();?>">
< ?php printAlbumThumbImage(getAlbumTitle()); ?>
</a>
< ?php endwhile; ?>
Minimal code for the loop, yet still powerful. The functions run in “contexts” which give internal template functions more info on where they’re called. next_album(), next_image(), next_comment() etc. control the context switching behind the scenes. It’s mostly for error control to make sure you don’t call a function out of context, but I still think it’s cool.
This release is a fully functional photo album (as you can see). From this base, I can start on the features that will make zenphoto really cool. I’m still looking for ideas on how to make it even better, so keep the comments coming.
[ Update: I just cleared the image cache so you can see my slow server process the images on the fly. The album to test is iStock; it has some 5-megapixel images, and you can really feel it churning away. But—most importantly, the page loads fast regardless of how fast the image loads, which makes it feel responsive, and all further views of that image are instant. ]
[ Update Again: Okay okay okay, I just got this great idea: Predictive image processing. Based on some algorithm, start preloading normal-sized images based on the thumbnails that are currently being loaded. And do it through hidden IMG tags in the HTML, which return 1px blank images (gasp) so that there’s still no lag from it. I’ll see. And it’d be optional of course. ]








I’ve secretly been keeping an eye on this project but now that you have something to show us, I think it is time for me to come out of my hole and congratulate you on your work so far. I am glad to see this progressing with such velocity and anxious to set up my own gallery with your software.
Thanks for the comment Stephanie. I hope to have it completed within the next two to three months, and hopefully we’ll have a good default template by then as well.
Everyone else: I’ve cleared the cache again, so you’ll see it processing images.
Tristan, certainly does feel pretty quick. I have a question about the markup that’s being produced. On the thumbnail page it looks like:
div class=”image”
div class=”imagethumb”
a href=””
img src=”” /div
/div
Question: Why two divs and two classes for one image? More specifically, how much of the final markup is from a template and how much is dictated by the php?
Looks great, I can’t wait to see a release.
Chris—every bit of layout is dictated by the template, or can be anyway. There are two classes of template functions: get[Something] and print[Something]. The get* functions just return information directly, and can be used to make the markup however you want it. The print* functions give you a little extra help and actually print nice valid XHTML, with their arguments being their content and optional attributes. All attributes can be controlled in the print* functions, so you still get a lot of control.
Essentially, you make it however you want it. All of the markup is in the template, and if you want to use some predefined code segments, they’re available.
In my template, I used two divs because I was floating the imagethumb in case I wanted to put title/description next to it, but I decided against it. The final templates will be much more complete; this one’s just for testing.
Nice!
In reference to your latest update with preloading images, there is already a way to do this. Mozilla-based browsers fully support it, and it is similar to what the somewhat new Google Web Accelerator uses.
It is called Link Prefetching, and you can read about it in Mozilla’s Link Prefetching FAQ.
Jeff—I could use link prefetching, but it’s not exactly the functionality I want. First, I don’t necessarily want the browser to preload the image, and second, it’s not fully compatible with every browser.
I know how to implement what I want—a way to predict what sized images need to be processed by the server before they are loaded so that there’s no (or rarely) a wait for the image processing. It’s pretty easy to do—in my image processing script, I’ll just put directives at the end to process “closeby” images after the current one has already been returned to the browser.
It’s just a nice speedup when new albums are loaded; not a big integral feature. I’ll try it if I have time.
Looks great, Tristan! I’m still a little confused on how it processses the images. It only creates a resized picture onces, right? What do you mean clear your server’s cache? I’m still a little unclear on how it processes thumbnails; it doesn’t recreate them every time the page is refreshed, does it?
Nope, if you look at the source, each image is actually a PHP script “i.php” with some arguments. It’s basically a pass-through for image requests, which dynamically creates, caches, and returns images to the browser based on its arguments. Quite elegant, actually, if I may say so myself.
What I mean by a cache is that I store resized versions of the images on the server after they are processed, so they don’t have to be re-processed. So no, it dosn’t recreate anything. If the cached image exists, the image script just passes it straight to the browser from the file. Otherwise. it’s created, then passed through.
When I say I’m clearing the cache, I’m just deleting all those pre-processed images so you can see the slight delay when it processes them for the first time. It’s just for testing.
Where are the cruft free URL’s?
Awwww come on! That’s the easy stuff! I’ll do it tomorrow.
hahahaha….
excellent.
Hi Tristan,
I’m a fellow member of WHA.. I’ve visited your site a couple of times before but never said hi. Just wanted to let you know that zenphoto is looking awesome. I was going to start making my own gallery script a few months back but school kept me busy, so I never got on to it… so I congratulate you for making this
I look forward to it being released. Keep up the good work!
Thanks Jeremy—it’s only the base program so far, like I said. Now it’s time to make it cool.
Hi. Yes, my name really is Tristan, too.
Today’s my first visit to your site. Not much to say on the current stage of the gallery, but based off the preliminary specifiations I’m definately going to keep an eye out.
Fast work so far, keep it up.
Tristan, sorry took me so long to reply but I lost the link I’d saved (whisper:: subscribe to comments…)
I’m really happy about the template situation. Looking forward to templating something other than WordPress.
I’ve been looking EVERYWHERE for a very simple but powerful image gallery (I suspect heaps of people are). The thing is I use iView to catalog my pics (which is awsome, could’nt recommend it highly enough) and, like PS, it lets you add all kinds of IPTC info. I just can’t find a simple galery sytem that lets you display the IPTC info. The closest thing I can find is Snipe Gallery which says it has the ability but I can’t get it to work.
It would be great if you could add the ability to display the IPTC info from pics – just a thought.
iView – http://www.iview-multimedia.com/
Snipe Gallery – http://www.snipegallery.com/
Mick – That’s something that might better be handled by an outside script or plugin. I am thinking about providing a plugin architecture sometime in the future.
If I can see the format of an IPTC file, I might be able to make an importer. As long as I can match up the entries with the right image or album, it shouldn’t be too hard. I’m not going to do it yet though.
Entering new metadata should be ridiculously simple though, so I wouldn’t worry too much
Great work Tristan!
You’re working very fast and the zenphoto specifiations look amazing too, as i’ve already commented before.
It looks like everyone is looking for a simple yet powerful gallery for their photography blog or portfolio.
Continue with the good work and keep us posted!