public function setWatermark(
        $file,
        $position = null,
        $size = null,
        $width = null,
        $height = null,
        $opacity = null
    ) {
        if ($this->isBaseFilePlaceholder) {
            return $this;
        }

        if ($file) {
            $this->setWatermarkFile($file);
        } else {
            return $this;
        }

        if ($position) {
            $this->setWatermarkPosition($position);
        }
        if ($size) {
            $this->setWatermarkSize($size);
        }
        if ($width) {
            $this->setWatermarkWidth($width);
        }
        if ($height) {
            $this->setWatermarkHeight($height);
        }
        if ($opacity) {
            $this->setWatermarkImageOpacity($opacity);
        }
        $filePath = $this->getWatermarkFilePath();

        if ($filePath) {
            $imagePreprocessor = $this->getImageProcessor();
            $imagePreprocessor->setWatermarkPosition($this->getWatermarkPosition());
            $imagePreprocessor->setWatermarkImageOpacity($this->getWatermarkImageOpacity());
            $imagePreprocessor->setWatermarkWidth($this->getWatermarkWidth());
            $imagePreprocessor->setWatermarkHeight($this->getWatermarkHeight());
            $imagePreprocessor->watermark($filePath);
        }

        return $this;
    }
public function setWatermark(
        $file,
        $position = null,
        $size = null,
        $width = null,
        $height = null,
        $opacity = null
    ) {
        if ($this->isBaseFilePlaceholder) {
            return $this;
        }

        if ($file) {
            $this->setWatermarkFile($file);
        } else {
            return $this;
        }

        if ($position) {
            $this->setWatermarkPosition($position);
        }
        if ($size) {
            $this->setWatermarkSize($size);
        }
        if ($width) {
            $this->setWatermarkWidth($width);
        }
        if ($height) {
            $this->setWatermarkHeight($height);
        }
        if ($opacity) {
            $this->setWatermarkImageOpacity($opacity);
        }
        $filePath = $this->getWatermarkFilePath();

        if ($filePath) {
            $imagePreprocessor = $this->getImageProcessor();
            $imagePreprocessor->setWatermarkPosition($this->getWatermarkPosition());
            $imagePreprocessor->setWatermarkImageOpacity($this->getWatermarkImageOpacity());
            $imagePreprocessor->setWatermarkWidth($this->getWatermarkWidth());
            $imagePreprocessor->setWatermarkHeight($this->getWatermarkHeight());
            $imagePreprocessor->watermark($filePath);
        }

        return $this;
    }
public function setWatermark ( $ file , $ position = null , $ size = null , $ width = null , $ height = null , $ opacity = null ) { if ( $ this -> isBaseFilePlaceholder ) { return $ this ; } if ( $ file ) { $ this -> setWatermarkFile ( $ file ) ; } else { return $ this ; } if ( $ position ) { $ this -> setWatermarkPosition ( $ position ) ; } if ( $ size ) { $ this -> setWatermarkSize ( $ size ) ; } if ( $ width ) { $ this -> setWatermarkWidth ( $ width ) ; } if ( $ height ) { $ this -> setWatermarkHeight ( $ height ) ; } if ( $ opacity ) { $ this -> setWatermarkImageOpacity ( $ opacity ) ; } $ filePath = $ this -> getWatermarkFilePath ( ) ; if ( $ filePath ) { $ imagePreprocessor = $ this -> getImageProcessor ( ) ; $ imagePreprocessor -> setWatermarkPosition ( $ this -> getWatermarkPosition ( ) ) ; $ imagePreprocessor -> setWatermarkImageOpacity ( $ this -> getWatermarkImageOpacity ( ) ) ; $ imagePreprocessor -> setWatermarkWidth ( $ this -> getWatermarkWidth ( ) ) ; $ imagePreprocessor -> setWatermarkHeight ( $ this -> getWatermarkHeight ( ) ) ; $ imagePreprocessor -> watermark ( $ filePath ) ; } return $ this ; }
Add watermark to image
size param in format 100x200

@param string $file
@param string $position
@param array $size ['width' => int, 'height' => int]
@param int $width
@param int $height
@param int $opacity
@return $this
@SuppressWarnings(PHPMD.NPathComplexity)
Add watermark to image size param in format 100x200