1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| waterMark(key) { const that = this;
const options = { Method: 'post', Pathname: '/' + key, Expires: 60 };
const authorization = COS.getAuthorization({ SecretId: 'AKIDMauCpHF4Zr360jrbs5c2LYotiL065zbj', SecretKey: 'FMT6dzBIFKKvjRxc4SFraUPI3KpNOAlB', Method: options.Method, Pathname: options.Pathname, Query: options.Query, Headers: options.Headers, Expires: 60, });
const thumb = key.replace('.', '.wm.') wx.request({ method: 'post', url: 'https://img-1255000004.pic.ap-chengdu.myqcloud.com/' + key + '?image_process', header: { 'Authorization': authorization, 'Pic-Operations': JSON.stringify({ "is_pic_info": 1, "rules": [{ "fileid": thumb, "rule": "imageMogr2/thumbnail/!50p|watermark/2/text/546v5aGUMjAxOQ==/fontsize/100/fill/I2ZmZmZmZg==/dissolve/50/gravity/center" }] }) }, success(res) { }, fail(err) { wx.showModal({ title: 'err', content: JSON.stringify(err), }) console.log(err) } }) },
|