An image watermark service module for Zend Framework 2
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/kaiohken1982/Watermarker.git"
}
],
"require": {
......,
"razor/watermarker" : "dev-master"
}
}
Take the file config/watermarker.local.php.dist, rename it depending on your environment, remove the dist suffix and add it inside you autoload directory. You can set the value for these two path
- watermarkFile: the physical path where your watermark is located
- tmpDir: the physical path for elaborated watermark
return array(
'watermarker' => array(
'watermarkFile' => '/path/to/watermark.gif',
'tmpDir' => '/path/to/tmp'
),
);
In a controller
$watermarker = $this->getServiceLocator()->get('Watermarker');
$watermarker->openImage('/path/to/image.jpg');
// This line is not needed if watermark file is given within configuration file
$watermarker->openWatermark('/path/to/watermark.gif');
$watermarker->watermark();
Please note you must be in the module root.
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
./vendor/bin/phpunit --coverage-html data/coverage