src/BaiduBce/Services/Media/MediaClient.php
public function createWatermark(
        $bucket, 
        $key,
        $options = array()
    ) {
        list(
            $config,
            $verticalAlignment,
            $horizontalAlignment,
            $verticalOffsetInPixel,
            $horizontalOffsetInPixel
        ) = $this->parseOptions(
            $options,
            'config',
            'verticalAlignment',
            'horizontalAlignment',
            'verticalOffsetInPixel',
            'horizontalOffsetInPixel'
        );

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

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

        $body = array(
            'bucket' => $bucket,
            'key' => $key,
        );
        if ($verticalAlignment !== null) {
            $body['verticalAlignment'] = $verticalAlignment;
        }
        if ($horizontalAlignment !== null) {
            $body['horizontalAlignment'] = $horizontalAlignment;
        }
        if ($verticalOffsetInPixel !== null) {
            $body['verticalOffsetInPixel'] = $verticalOffsetInPixel;
        }
        if ($horizontalOffsetInPixel !== null) {
            $body['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body),
            ),
            '/watermark'
        );
    }
public function createWatermark(
        $bucket, 
        $key,
        $options = array()
    ) {
        list(
            $config,
            $verticalAlignment,
            $horizontalAlignment,
            $verticalOffsetInPixel,
            $horizontalOffsetInPixel
        ) = $this->parseOptions(
            $options,
            'config',
            'verticalAlignment',
            'horizontalAlignment',
            'verticalOffsetInPixel',
            'horizontalOffsetInPixel'
        );

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

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

        $body = array(
            'bucket' => $bucket,
            'key' => $key,
        );
        if ($verticalAlignment !== null) {
            $body['verticalAlignment'] = $verticalAlignment;
        }
        if ($horizontalAlignment !== null) {
            $body['horizontalAlignment'] = $horizontalAlignment;
        }
        if ($verticalOffsetInPixel !== null) {
            $body['verticalOffsetInPixel'] = $verticalOffsetInPixel;
        }
        if ($horizontalOffsetInPixel !== null) {
            $body['horizontalOffsetInPixel'] = $horizontalOffsetInPixel;
        }

        return $this->sendRequest(
            HttpMethod::POST,
            array(
                'config' => $config,
                'body' => json_encode($body),
            ),
            '/watermark'
        );
    }
public function createWatermark ( $ bucket , $ key , $ options = array ( ) ) { list ( $ config , $ verticalAlignment , $ horizontalAlignment , $ verticalOffsetInPixel , $ horizontalOffsetInPixel ) = $ this -> parseOptions ( $ options , 'config' , 'verticalAlignment' , 'horizontalAlignment' , 'verticalOffsetInPixel' , 'horizontalOffsetInPixel' ) ; if ( empty ( $ bucket ) ) { throw new BceClientException ( "The parameter bucket " . "should NOT be null or empty string" ) ; } if ( empty ( $ key ) ) { throw new BceClientException ( "The parameter key " . "should NOT be null or empty string" ) ; } $ body = array ( 'bucket' => $ bucket , 'key' => $ key , ) ; if ( $ verticalAlignment !== null ) { $ body [ 'verticalAlignment' ] = $ verticalAlignment ; } if ( $ horizontalAlignment !== null ) { $ body [ 'horizontalAlignment' ] = $ horizontalAlignment ; } if ( $ verticalOffsetInPixel !== null ) { $ body [ 'verticalOffsetInPixel' ] = $ verticalOffsetInPixel ; } if ( $ horizontalOffsetInPixel !== null ) { $ body [ 'horizontalOffsetInPixel' ] = $ horizontalOffsetInPixel ; } return $ this -> sendRequest ( HttpMethod :: POST , array ( 'config' => $ config , 'body' => json_encode ( $ body ) , ) , '/watermark' ) ; }
Create a watermark

@param string $bucket The source media BOS bucket
@param string $key the source media object key
@param array $options Supported options:
{
config: The optional bce configuration, which will overwrite the
default client configuration that was passed in constructor.
verticalAlignment: watermark vertical alignment, enum(top, center, bottom)
horizontalAlignment: watermark vertical alignment, enum(left, center, right)
verticalOffsetInPixel: numeric vertical offset, 0~3072
horizontalOffsetInPixel: numeric vertical offset, 0~4096
}
@return mixed
@throws BceClientException
@since 0.8.4
Create a watermark