I just published a small plugin for WordPress. I use it to dynamically resize and crop photos on this site.
WordPress resizes uploaded images to two different sizes. A thumbnail and a medium format. In most designs you would really like to control how an image is used on the page. Sometimes it will be a small cropped thumbnail, another time a bit bigger, or a nice medium format on the post pages themselves.
The wok-imager plugin enables this without you resizing the images for WordPress.
Tested with PHP 5.2 and WordPress 2.7 and 2.6.3. Many thanks to Tim Benniks for testing it with WordPress 2.7.
svn checkout http://wp-wok-imager.googlecode.com/svn/trunk/ wok-imager
Go to the admin page of your site and install the plugin.
Just add an image element in your page:
<img src="/wp-content/uploads/file.jpg" width="100" height="100" filter="crop,gray" />
The wok-imager will scan your generated page upon serving, apply the width, height and filters to the image and change the tag into something like:
<img src="/wp-content/uploads/wok-imager/file.jpg/4ee630a60ec7feb605516ac5b98972d1.jpg" width="100" height="100" />
When you don’t supply the crop filter then the width and height are the maximum bounding rectangle of the image. The resulting image has either the given width or the given height but is never bigger than the given width and height. You can also supply just the width or the height to make the resized image unbounded in respectively the height or the width.
You can combine multiple filters by separating then with a comma. For example “crop,flip,gray”.
crop center crop
cropcc center crop
croptl upper left corner
cropbr lower right corner
You can add your own imager plugins. There are two examples in the imager-plugin directory.