Sybio/ImageWorkshop — pull request #37 by jasny (2014-03-04 13:21:13+00:00)
Title: Added resizeToFit and cropToAspectRatio methods

Added 2 methods:

* `ImageWorkshopLayer::resizeToFit()` resizes an image to fit a bounding box.
* `ImageWorkshopLayer::cropToAspectRatio()` crops either to width or height of the document to match the aspect ratio.

Example usage of `resizeToFit()`
```php
// Shrink the image so the width is <= 150px and the height <= 200px, maintaining the aspect ratio
$pic->resizeToFitinPixel(150, 200);
```
* If the original image is 300x250, the new image will be 150x100.
* If the original image is 200x400, the new image will be 100x200.
* If the original image is 100x100, the new image will be 100x100.

Example usage of `cropToAspectRatio()`
```php
// Crop picture to 4:3 aspect ratio, cropping from the center
$pic->cropToAspectRatioInPercent(4, 3, 50, 50);

// Crop and resize the image to be exactly 100x100 pixels
$pic->cropToAspectRatioInPercent(1, 1, 50, 50); // Square
$pic->resizeInPixel(100, 100);
```