by

Updated PictureViewer Site

I updated PictureViewer to have album thumbnails, caching and use an HttpHandler to preserve the file names. The main page now has thumbnails (they’re a bit ugly, but I’ll clean up the scaling method soon). The images are now served out of natural sounding URLs (e.g. they end in .jpg or what have you) and scale if you put a ?scale=x% parameter on the query string. I implemented an HttpHandler to intercept the request and either return the image or scale it down to the requested size and return those bytes. The HttpHandler also handles setting the Expires header on the images in each albums, as well as the thumbnails so subsequent visits to an album are almost instantantous.

Further, I’m setting the Expires header on the HTML for an individual album, so if you’ve previously visited an alubm (within 90 days), the entire thing renders out of the browser’s cache. The main page, of course, is generated on the fly. The thumbnails that are shown on the main render from the cache (since it’s all from the same HttpHandler). I also have an optimization from a while ago where the thumbnails of 5% (since that’s the default scale for the thumbnails on the site) are cached to the server’s disk after they’ve been calculated and scaled.