TextWatermarkTemplate.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. namespace Qcloud\Cos\ImageParamTemplate;
  3. /**
  4. * Parses default XML exception responses
  5. */
  6. class TextWatermarkTemplate extends ImageTemplate
  7. {
  8. private $text;
  9. private $font;
  10. private $fontsize;
  11. private $fill;
  12. private $dissolve;
  13. private $gravity;
  14. private $dx;
  15. private $dy;
  16. private $batch;
  17. private $degree;
  18. private $shadow;
  19. public function __construct() {
  20. parent::__construct();
  21. $this->text = "";
  22. $this->font = "";
  23. $this->fontsize = "";
  24. $this->fill = "";
  25. $this->dissolve = "";
  26. $this->gravity = "";
  27. $this->dx = "";
  28. $this->dy = "";
  29. $this->batch = "";
  30. $this->degree = "";
  31. $this->shadow = "";
  32. }
  33. public function setText($value) {
  34. $this->text = "/text/" . $this->ciBase64($value);
  35. }
  36. public function setFont($value) {
  37. $this->font = "/font/" . $this->ciBase64($value);
  38. }
  39. public function setFontsize($value) {
  40. $this->fontsize = "/fontsize/" . $value;
  41. }
  42. public function setFill($value) {
  43. $this->fill = "/fill/" . $this->ciBase64($value);
  44. }
  45. public function setDissolve($value) {
  46. $this->dissolve = "/dissolve/" . $value;
  47. }
  48. public function setGravity($value) {
  49. $this->gravity = "/gravity/" . $value;
  50. }
  51. public function setDx($value) {
  52. $this->dx = "/dx/" . $value;
  53. }
  54. public function setDy($value) {
  55. $this->dy = "/dy/" . $value;
  56. }
  57. public function setBatch($value) {
  58. $this->batch = "/batch/" . $value;
  59. }
  60. public function setDegree($value) {
  61. $this->degree = "/degree/" . $value;
  62. }
  63. public function setShadow($value) {
  64. $this->shadow = "/shadow/" . $value;
  65. }
  66. public function getText() {
  67. return $this->text;
  68. }
  69. public function getFont() {
  70. return $this->font;
  71. }
  72. public function getFontsize() {
  73. return $this->fontsize;
  74. }
  75. public function getFill() {
  76. return $this->fill;
  77. }
  78. public function getDissolve() {
  79. return $this->dissolve;
  80. }
  81. public function getGravity() {
  82. return $this->gravity;
  83. }
  84. public function getDx() {
  85. return $this->dx;
  86. }
  87. public function getDy() {
  88. return $this->dy;
  89. }
  90. public function getBatch() {
  91. return $this->batch;
  92. }
  93. public function getDegree() {
  94. return $this->degree;
  95. }
  96. public function getShadow() {
  97. return $this->shadow;
  98. }
  99. public function queryString() {
  100. $head = "watermark/2";
  101. $res = "";
  102. if($this->text) {
  103. $res .= $this->text;
  104. }
  105. if($this->font) {
  106. $res .= $this->font;
  107. }
  108. if($this->fontsize) {
  109. $res .= $this->fontsize;
  110. }
  111. if($this->fill) {
  112. $res .= $this->fill;
  113. }
  114. if($this->dissolve) {
  115. $res .= $this->dissolve;
  116. }
  117. if($this->gravity) {
  118. $res .= $this->gravity;
  119. }
  120. if($this->dx) {
  121. $res .= $this->dx;
  122. }
  123. if($this->dy) {
  124. $res .= $this->dy;
  125. }
  126. if($this->batch) {
  127. $res .= $this->batch;
  128. }
  129. if($this->degree) {
  130. $res .= $this->degree;
  131. }
  132. if($this->shadow) {
  133. $res .= $this->shadow;
  134. }
  135. if($res) {
  136. $res = $head . $res;
  137. }
  138. return $res;
  139. }
  140. public function resetRule() {
  141. $this->text = "";
  142. $this->font = "";
  143. $this->fontsize = "";
  144. $this->fill = "";
  145. $this->dissolve = "";
  146. $this->gravity = "";
  147. $this->dx = "";
  148. $this->dy = "";
  149. $this->batch = "";
  150. $this->degree = "";
  151. $this->shadow = "";
  152. }
  153. }