razor/watermarker

An image watermark service module for Zend Framework 2

1.0.1 2014-07-15 20:18 UTC

This package is not auto-updated.

Last update: 2024-05-06 13:30:41 UTC


README

Build Status Coverage Status Dependency Status Latest Stable Version Total Downloads Latest Unstable Version License

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