Пример #1
0
        /// 对云上数据进行图片处理
        public void ProcessWithPicOperation()
        {
            string bucket  = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
            string key     = "exampleobject";            //对象键
            string srcPath = @"temp-source-file";        //本地文件绝对路径
            //.cssg-snippet-body-start:[process-with-pic-operation]
            JObject o = new JObject();

            // 不返回原图
            o["is_pic_info"] = 0;
            JArray  rules = new JArray();
            JObject rule  = new JObject();

            rule["bucket"] = bucket;
            rule["fileid"] = "desample_photo.jpg";
            //处理参数,规则参见:https://cloud.tencent.com/document/product/460/19017
            rule["rule"] = "imageMogr2/thumbnail/400x400";
            rules.Add(rule);
            o["rules"] = rules;
            string ruleString = o.ToString(Formatting.None);

            ImageProcessRequest request = new ImageProcessRequest(bucket, key, ruleString);
            ImageProcessResult  result  = cosXml.ImageProcess(request);
            //.cssg-snippet-body-end
        }