I’m using the Aggregate theme from Elegant Themes (nice, thanks Nick). Now like many of the Elegant Themes, Aggregate is using the TimThumb script for automatically resizing and cropping images. I like this script as it makes it easy to include images from other sites (like my SmugMug site), but sometimes (particularly in photos of people) it crops and zooms into the wrong place.
Now, Ben has added the alignment (‘a’) parameter, which works like this (see here for the full blog post):
- c : position in the center (this is the default)
- t : align top
- …
However, if you want partial adjustments to the crop location, you can’t currently achieve this.
To this end, I’ve added the percentage (‘p’) parameter which accepts a number between 0 and 100 representing a percentage. It works in combination with the alignment parameter like this:
- t : 0 represents the top alignment, 100 represents the bottom alignment (equivalent to alignment setting ‘b’) and values in between represent a proportional alignment of the crop area (see example below);
- b : 0 represents the bottom alignment, and 100 represents the top alignment (equivalent to alignment setting ‘t’);
- l : 0 represents the left alignment, and 100 represents the right alignment (equivalent to alignment setting ‘r’); and
- r : 0 represents the right alignment, and 100 represents the left alignment (equivalent to alignment setting ‘l’);
For example:
I’ve submitted this as a patch on the Google Code TimThumb project here, or you can download my patched version (of the latest code) here.
Thanks for the feedback and the code submission. I tend to go through periods of updating TimThumb and will be sure to check out your changes the next time I do any commits 🙂
No problems. And thanks for TimThumb.