diff --git a/src/PHPThumb/GD.php b/src/PHPThumb/GD.php index 350bf19..a03adcc 100644 --- a/src/PHPThumb/GD.php +++ b/src/PHPThumb/GD.php @@ -935,6 +935,14 @@ public function save($fileName, $format = null) } } + //Execute any plugins + if ($this->plugins) { + foreach ($this->plugins as $plugin) { + /* @var $plugin \PHPThumb\PluginInterface */ + $plugin->execute($this); + } + } + // When the interlace option equals true or false call imageinterlace else leave it to default if ($this->options['interlace'] === true) { imageinterlace($this->oldImage, 1); diff --git a/src/PHPThumb/Plugins/Sharpen.php b/src/PHPThumb/Plugins/Sharpen.php new file mode 100644 index 0000000..9ef0c0a --- /dev/null +++ b/src/PHPThumb/Plugins/Sharpen.php @@ -0,0 +1,53 @@ + + * Copyright (c) 2009, Ian Selby/Gen X Design + * + * Author(s): Ian Selby + * + * Licensed under the MIT License + * Redistributions of files must retain the above copyright notice. + * + * @author Ian Selby + * @copyright Copyright (c) 2009 Gen X Design + * @link http://phpthumb.gxdlabs.com + * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * @version 3.0 + * @package PhpThumb + * @filesource + */ + + +namespace PHPThumb\Plugins; + +/** + * Sharpen Lib Plugin + * + * This plugin allows you to create a sharpened version of your image + * @author Remi Heens + * @package PhpThumb + * @subpackage Plugins + */ +class Sharpen implements \PHPThumb\PluginInterface +{ + public function execute($phpthumb) + { + // sharpen image + $sharpenMatrix = array ( + array (-1,-1,-1), + array (-1,16,-1), + array (-1,-1,-1), + ); + + $divisor = 8; + $offset = 0; + + imageconvolution ($phpthumb->getWorkingImage(), $sharpenMatrix, $divisor, $offset); + + } +} \ No newline at end of file