API | Description |
Adds a blind watermark to or extracts a blind watermark from a local image and uploads the image to a bucket. |
opt := &cos.ObjectPutOptions{nil,&cos.ObjectPutHeaderOptions{XOptionHeader: &http.Header{},},}pic := &cos.PicOperations{IsPicInfo: 1,Rules: []cos.PicOperationsRules{{FileId: ".jpg",Rule: "watermark/3/type/3/text/" + base64.StdEncoding.EncodeToString([]byte("testwatermark")),},},}opt.XOptionHeader.Add("Pic-Operations", cos.EncodePicOperations(pic))name := "test.jpg"filepath := "./test.jpg"res, _, err := c.CI.PutFromFile(context.Background(), name, filepath, opt)
name = "test.jpg"filepath := "watermark.jpg"_, err = c.CI.GetToFile(context.Background(), name, filepath, "watermark/3/type/3/text/"+base64.StdEncoding.EncodeToString([]byte("testwatermark")), nil)
Pic-Operations
to the request header and use the blind watermark extraction parameter watermark/4
.opt := &cos.ObjectPutOptions{nil,&cos.ObjectPutHeaderOptions{XOptionHeader: &http.Header{},},}pic := &cos.PicOperations{IsPicInfo: 1,Rules: []cos.PicOperationsRules{{FileId: "format2.jpg",Rule: "watermark/4/type/3/text/" + base64.StdEncoding.EncodeToString([]byte("testwatermark")),},},}opt.XOptionHeader.Add("Pic-Operations", cos.EncodePicOperations(pic))name := "test2.jpg"_, err := c.Object.PutFromFile(context.Background(), name, filepath, opt)
Apakah halaman ini membantu?