src/BaiduBce/Services/Lss/LssClient.php
public function createImageWatermark($name, $content, $options = array())
    {
        list($config, $maxWidthInPixel, $maxHeightInPixel,
            $sizingPolicy, $verticalAlignment, $horizontalAlignment,
            $verticalOffsetInPixel, $horizontalOffsetInPixel) = $this->parseOptions(
            $options,
            'config',
            'maxWidthInPixel',
            'maxHeightInPixel',
            'sizingPolicy',
            'verticalAlignment',
            'horizontalAlignment',
            'verticalOffsetInPixel',
            'horizontalOffsetInPixel'
        );

        if (empty($name)) {
            throw new BceClientException("The parameter name "
                . "should NOT be null or empty string");
        }
        if (empty($content)) {
            throw new BceClientException("The parameter content "
                . "should NOT be null or empty string");
        }

        $body = array(
            'name' => $name,
            'content' => $content,
        );

        $size = array();
        if ($maxWidthInPixel !== null) {
            $size['maxWidthInPixel'] = $maxWidthInPixel;
        }
        if ($maxHeightInPixel !== null) {
            $size['maxHeightInPixel'] = $maxHeightInPixel;
        }
        if ($sizingPolicy !== null) {
            $size['sizingPolicy'] = $sizingPolicy;
        }
        if (count($size) > 0) {
            $body['size'] = $size;
        }

        $position = array();
        if ($verticalAlignment !== null) {
            $position['verticalAlignment'] = $verticalAlignment;
        }
        if ($horizontalAlignment !== null) {
            $position['horizontalAlignment'] = $horizontalAlignment;
        }
        if ($verticalOffsetInPixel !== null) {
            $position['verticalOffsetInPixel'] = $verticalOffsetInPixel;
        }
        if ($horizontalOffsetInPixel !== null) {
            $position['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
        }
        if (count($position) > 0) {
            $body['position'] = $position;
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body, JSON_FORCE_OBJECT),
            ),
            "/watermark/image"
        );
    }
public function createImageWatermark($name, $content, $options = array())
    {
        list($config, $maxWidthInPixel, $maxHeightInPixel,
            $sizingPolicy, $verticalAlignment, $horizontalAlignment,
            $verticalOffsetInPixel, $horizontalOffsetInPixel) = $this->parseOptions(
            $options,
            'config',
            'maxWidthInPixel',
            'maxHeightInPixel',
            'sizingPolicy',
            'verticalAlignment',
            'horizontalAlignment',
            'verticalOffsetInPixel',
            'horizontalOffsetInPixel'
        );

        if (empty($name)) {
            throw new BceClientException("The parameter name "
                . "should NOT be null or empty string");
        }
        if (empty($content)) {
            throw new BceClientException("The parameter content "
                . "should NOT be null or empty string");
        }

        $body = array(
            'name' => $name,
            'content' => $content,
        );

        $size = array();
        if ($maxWidthInPixel !== null) {
            $size['maxWidthInPixel'] = $maxWidthInPixel;
        }
        if ($maxHeightInPixel !== null) {
            $size['maxHeightInPixel'] = $maxHeightInPixel;
        }
        if ($sizingPolicy !== null) {
            $size['sizingPolicy'] = $sizingPolicy;
        }
        if (count($size) > 0) {
            $body['size'] = $size;
        }

        $position = array();
        if ($verticalAlignment !== null) {
            $position['verticalAlignment'] = $verticalAlignment;
        }
        if ($horizontalAlignment !== null) {
            $position['horizontalAlignment'] = $horizontalAlignment;
        }
        if ($verticalOffsetInPixel !== null) {
            $position['verticalOffsetInPixel'] = $verticalOffsetInPixel;
        }
        if ($horizontalOffsetInPixel !== null) {
            $position['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
        }
        if (count($position) > 0) {
            $body['position'] = $position;
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body, JSON_FORCE_OBJECT),
            ),
            "/watermark/image"
        );
    }
public function createImageWatermark ( $ name , $ content , $ options = array ( ) ) { list ( $ config , $ maxWidthInPixel , $ maxHeightInPixel , $ sizingPolicy , $ verticalAlignment , $ horizontalAlignment , $ verticalOffsetInPixel , $ horizontalOffsetInPixel ) = $ this -> parseOptions ( $ options , 'config' , 'maxWidthInPixel' , 'maxHeightInPixel' , 'sizingPolicy' , 'verticalAlignment' , 'horizontalAlignment' , 'verticalOffsetInPixel' , 'horizontalOffsetInPixel' ) ; if ( empty ( $ name ) ) { throw new BceClientException ( "The parameter name " . "should NOT be null or empty string" ) ; } if ( empty ( $ content ) ) { throw new BceClientException ( "The parameter content " . "should NOT be null or empty string" ) ; } $ body = array ( 'name' => $ name , 'content' => $ content , ) ; $ size = array ( ) ; if ( $ maxWidthInPixel !== null ) { $ size [ 'maxWidthInPixel' ] = $ maxWidthInPixel ; } if ( $ maxHeightInPixel !== null ) { $ size [ 'maxHeightInPixel' ] = $ maxHeightInPixel ; } if ( $ sizingPolicy !== null ) { $ size [ 'sizingPolicy' ] = $ sizingPolicy ; } if ( count ( $ size ) > 0 ) { $ body [ 'size' ] = $ size ; } $ position = array ( ) ; if ( $ verticalAlignment !== null ) { $ position [ 'verticalAlignment' ] = $ verticalAlignment ; } if ( $ horizontalAlignment !== null ) { $ position [ 'horizontalAlignment' ] = $ horizontalAlignment ; } if ( $ verticalOffsetInPixel !== null ) { $ position [ 'verticalOffsetInPixel' ] = $ verticalOffsetInPixel ; } if ( $ horizontalOffsetInPixel !== null ) { $ position [ 'horizontalOffsetInPixel' ] = $ horizontalOffsetInPixel ; } if ( count ( $ position ) > 0 ) { $ body [ 'position' ] = $ position ; } return $ this -> sendRequest ( HttpMethod :: POST , array ( 'config' => $ config , 'body' => json_encode ( $ body , JSON_FORCE_OBJECT ) , ) , "/watermark/image" ) ; }
Create a image watermark.

@param $name string, image watermark name
@param $content string, watermark image base64 encode
@param array $options Supported options:
{
config: the optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
maxWidthInPixel: number, watermark maximum width in pixel
maxHeightInPixel: number, watermark maximum Height in pixel
sizingPolicy: string, watermark size retractable policy
verticalAlignment: string, vertically aligned manner
horizontalAlignment: string, horizontal aligned manner
verticalOffsetInPixel: number, vertical offset in pixel
horizontalOffsetInPixel: number, horizontal offset in pixel
}
@return mixed
@throws BceClientException
Create a image watermark .