Some of the code is kind of messy, but hopefully it gives you an idea.
For use in https://github.com/iloveitaly/XtLightbox w/GalleryManager
DynamicImage is an image manipulation library written as a Kohana 2 module: https://github.com/iloveitaly/DynamicImage/
The substr()
business was to handle a specific issue in the deployment I was dealing with.
The wrapper
class and possibly some other other css is part of a bigger production library.
Live Ex: http://prorefinish.com/base/gallery