简介
本文档提供关于盲水印相关的 API 概览以及 SDK 示例代码。
添加盲水印
功能说明
盲水印支持在上传时添加以及下载时添加。
示例代码一:上传时添加盲水印
PutObjectRequest request = new PutObjectRequest(bucket, key, srcPath);
JObject o = new JObject();
o["is_pic_info"] = 0;
JArray rules = new JArray();
JObject rule = new JObject();
rule["bucket"] = bucket;
rule["fileid"] = key;
rule["rule"] = "watermark/3/type/<type>/image/<imageUrl>/text/<text>/level/<level>";
rules.Add(rule);
o["rules"] = rules;
string ruleString = o.ToString(Formatting.None);
request.SetRequestHeader("Pic-Operations", ruleString);
PutObjectResult result = cosXml.PutObject(request);
示例代码二:下载时添加盲水印
GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, key, localDir, localFileName);
getObjectRequest.SetQueryParameter("watermark/3/type/<type>/image/<imageUrl>/text/<text>", null);
GetObjectResult result = cosXml.GetObject(getObjectRequest);
本页内容是否解决了您的问题?