razor / watermarker
An image watermark service module for Zend Framework 2
1.0.1
2014-07-15 20:18 UTC
Requires
- php: >=5.3.3
- ext-gd: *
- razor/thumbnailer: 1.*
- zendframework/zendframework: 2.*
Requires (Dev)
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-12-16 16:12:32 UTC
README
An image watermark service module for Zend Framework 2
Install with Composer
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/kaiohken1982/Watermarker.git"
}
],
"require": {
......,
"razor/watermarker" : "dev-master"
}
}
Configuration
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'
),
);
How to use
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();
Run unit test
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