File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 2727 $ textWatermarkRule ->setBatch (1 ); // 平铺水印功能,可将文字水印平铺至整张图片。值为1时,表示开启平铺水印功能
2828 $ textWatermarkRule ->setDegree (10 ); // 当 batch 值为1时生效。文字水印的旋转角度设置,取值范围为0 - 360,默认0
2929 $ textWatermarkRule ->setShadow (10 ); // 文字阴影效果,有效值为[0,100],默认为0,表示无阴影
30+ $ textWatermarkRule ->setScatype (1 ); // 根据原图的大小,缩放调整文字水印的大小
31+ $ textWatermarkRule ->setSpcent (500 ); // 与 scatype 搭配使用
3032
3133 $ picOperations = new Qcloud \Cos \ImageParamTemplate \PicOperationsTransformation ();
3234 $ picOperations ->setIsPicInfo (1 ); // is_pic_info
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ class TextWatermarkTemplate extends ImageTemplate
1818 private $ batch ;
1919 private $ degree ;
2020 private $ shadow ;
21+ private $ scatype ;
22+ private $ spcent ;
2123
2224 public function __construct () {
2325 parent ::__construct ();
@@ -32,6 +34,8 @@ public function __construct() {
3234 $ this ->batch = "" ;
3335 $ this ->degree = "" ;
3436 $ this ->shadow = "" ;
37+ $ this ->scatype = "" ;
38+ $ this ->spcent = "" ;
3539 }
3640
3741 public function setText ($ value ) {
@@ -78,6 +82,14 @@ public function setShadow($value) {
7882 $ this ->shadow = "/shadow/ " . $ value ;
7983 }
8084
85+ public function setScatype ($ value ) {
86+ $ this ->scatype = "/scatype/ " . $ value ;
87+ }
88+
89+ public function setSpcent ($ value ) {
90+ $ this ->spcent = "/spcent/ " . $ value ;
91+ }
92+
8193 public function getText () {
8294 return $ this ->text ;
8395 }
@@ -122,6 +134,14 @@ public function getShadow() {
122134 return $ this ->shadow ;
123135 }
124136
137+ public function getScatype () {
138+ return $ this ->scatype ;
139+ }
140+
141+ public function getSpcent () {
142+ return $ this ->spcent ;
143+ }
144+
125145 public function queryString () {
126146 $ head = "watermark/2 " ;
127147 $ res = "" ;
@@ -158,6 +178,12 @@ public function queryString() {
158178 if ($ this ->shadow ) {
159179 $ res .= $ this ->shadow ;
160180 }
181+ if ($ this ->scatype ) {
182+ $ res .= $ this ->scatype ;
183+ }
184+ if ($ this ->spcent ) {
185+ $ res .= $ this ->spcent ;
186+ }
161187 if ($ res ) {
162188 $ res = $ head . $ res ;
163189 }
@@ -176,5 +202,7 @@ public function resetRule() {
176202 $ this ->batch = "" ;
177203 $ this ->degree = "" ;
178204 $ this ->shadow = "" ;
205+ $ this ->scatype = "" ;
206+ $ this ->spcent = "" ;
179207 }
180208}
You can’t perform that action at this time.
0 commit comments