Image Cropper Module
, (*1)
An image cropper service module for Zend Framework 2., (*2)
Install with Composer
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/kaiohken1982/Cropper.git"
}
],
"require": {
......,
"razor/cropper" : "dev-master"
}
}
, (*3)
How to use
In a controller, (*4)
```
$cropper = $this->getServiceLocator()->get('Cropper');
$cropper->open('/path/to/image.jpg');, (*5)
// Type of the cut, on top image (2) or centered (1), default 1
// $cropper->setType(1);
// this will cut a 200x200 square
$cropper->setSize(200, 200);
// this will cut a square in the source image, where side equal source image width
//$cropper->setSquareMode(true);
$cropper->save('/path/to/image_cropped.jpg');
```, (*6)
Run unit test
Please note you must be in the module root., (*7)
curl -s http://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit
If you have xdebug enabled and you want to see code coverage
run the command below, it'll create html files in
Watermarker\test\data\coverage, (*8)
./vendor/bin/phpunit --coverage-html data/coverage