Improved Image Resizing and Site Move
After much playing around I decided that my image resize script was chewing up too much processor time and memory, thus making page loads a lot longer.
The solution? Cache the thumbnails, and each time the script is called, check to see if an image with those parameters has already been created. If it has, return that image straight from storage, no waiting for it to be re-rendered.
But what happens if the original image is changed, surely the cached thumbnail will be out of date? For this I check that the last-modified date of the thumbnail is greater than that of the original. If not, it renders a new one.
Pretty spiffing. I’ll probably release this script when I’ve cleaned it up a bit
Anyone sharp eyed will have noticed that the URI for this page has changed slightly, I moved my site to the root directory, just felt like it really. I’m getting a lot of things not working because of this, so email any errors you come across to dougal@shearfx.com. Thanks.