|
@@ -227,11 +227,32 @@ class Index extends Controller
|
|
|
$data['storage'] = 'qiniu';
|
|
|
Attachment::create($data, true);
|
|
|
|
|
|
+ //水印
|
|
|
+ if(in_array($suffix,['jpg','png','bmp','jpeg']))
|
|
|
+ {
|
|
|
+ $username = \app\common\library\Auth::instance()->username;
|
|
|
+ $url.= $this->water_param($username);
|
|
|
+ }
|
|
|
+ //水印
|
|
|
+
|
|
|
$this->success("上传成功", '', ['url' => $url, 'fullurl' => cdnurl($url, true), 'hash' => $hash]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 七牛云水印链接
|
|
|
+ * 传入用户展示id
|
|
|
+ * https://developer.qiniu.com/dora/1316/image-watermarking-processing-watermark
|
|
|
+ */
|
|
|
+ public function water_param($username = ''){
|
|
|
+ $shuiyin_img = 'kodo://tken'.config('site.shuiyin') ?: 'kodo://tken/logo.png';
|
|
|
+ $username = !empty($username) ? $username : 'Tken';
|
|
|
+ $param_str = '?watermark/3/image/'.base64_encode($shuiyin_img).'/dissolve/50/ws/0.1/wst/0/text/'.base64_encode('@'.$username).'/fontsize/300/dissolve/80/gravity/SouthWest/dx/20/dy/20/fill/'.base64_encode('#FFFFFF');
|
|
|
+
|
|
|
+ return $param_str;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 通知回调
|
|
|
*/
|
|
|
public function notify()
|