diff --git a/Controller.php b/Controller.php index bd89d32..4b69e37 100644 --- a/Controller.php +++ b/Controller.php @@ -28,6 +28,7 @@ class Controller extends BaseController{ public $roots = []; public $access = ['@']; public $disabledCommands = ['netmount']; + public $watermark; public function behaviors() { @@ -69,6 +70,20 @@ public function getOptions() $this->_options['roots'][] = $root->getRoot(); } + if(!empty($this->watermark)){ + $this->_options['bind']['upload.presave'] = 'Plugin.Watermark.onUpLoadPreSave'; + + if(is_string($this->watermark)){ + $watermark = [ + 'source' => $this->watermark + ]; + }else{ + $watermark = $this->watermark; + } + + $this->_options['plugin']['Watermark'] = $watermark; + } + return $this->_options; } diff --git a/PathController.php b/PathController.php index 99144e5..1528d21 100644 --- a/PathController.php +++ b/PathController.php @@ -32,6 +32,7 @@ class PathController extends Controller{ 'basePath' => '@webroot/files', 'path' => '' ]; + public $watermark; public function behaviors() { @@ -78,6 +79,20 @@ public function getOptions($subPath = '') if($root->isAvailable()) $this->_options['roots'][] = $root->getRoot(); + if(!empty($this->watermark)){ + $this->_options['bind']['upload.presave'] = 'Plugin.Watermark.onUpLoadPreSave'; + + if(is_string($this->watermark)){ + $watermark = [ + 'source' => $this->watermark + ]; + }else{ + $watermark = $this->watermark; + } + + $this->_options['plugin']['Watermark'] = $watermark; + } + return $this->_options; }