octobercms/library — pull request #18 by DanielHitchen (2014-06-12 11:36:12+00:00)
Title: [Feature Request] Added "offset" to getThumb() options

Hope this works, this is my first Pull Request, so be gentle :)

OK, I've added the option to apply an offset to a cropped image, in the off chance that when the image is cropped, the image doesn't sit quite right, or the cropping isn't focusing on the correct area.

e.g (in Twig)
This is the standard image:
![Image 1](https://cloud.githubusercontent.com/assets/7501909/3256920/ea709ba2-f220-11e3-852a-9e95ce59ee7c.jpg)

if using the Twig method ```thumb``` like ```{{ image.thumb(1040, 300, {'mode':'crop','extension':'jpg', 'offset':[0, 0]}) }}``` to crop the image to ```1040x300```, the image you end up with is:
![image 2](https://cloud.githubusercontent.com/assets/7501909/3256925/1734d16c-f221-11e3-8fb0-3edc8271ae9f.jpg)

but with the new offset option, you can adjust the ```LEFT``` and ```TOP``` offsets to get a better fit for the images focal point, like:
![Image 3](https://cloud.githubusercontent.com/assets/7501909/3256946/62c4f134-f221-11e3-9240-e84f1dd112d8.jpg)
using ```{{ image.thumb(1040, 300, {'mode':'crop','extension':'jpg', 'offset':[0, 115]}) }}```

Hope that all makes sense & more importantly works!! ;)