BlindWatermarkTemplate.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace Qcloud\Cos\ImageParamTemplate;
  3. class BlindWatermarkTemplate extends ImageTemplate {
  4. private $markType;
  5. private $type;
  6. private $image;
  7. private $text;
  8. private $level;
  9. public function __construct() {
  10. parent::__construct();
  11. $this->markType = 3;
  12. $this->type = "";
  13. $this->image = "";
  14. $this->text = "";
  15. $this->level = "";
  16. }
  17. public function setPick() {
  18. $this->markType = 4;
  19. }
  20. public function setType($value) {
  21. $this->type = "/type/" . $value;
  22. }
  23. public function setImage($value) {
  24. $this->image = "/image/" . $this->ciBase64($value);
  25. }
  26. public function setText($value) {
  27. $this->text = "/text/" . $this->ciBase64($value);
  28. }
  29. public function setLevel($value) {
  30. $this->level = "/level/" . $value;
  31. }
  32. public function getType() {
  33. return $this->type;
  34. }
  35. public function getImage() {
  36. return $this->image;
  37. }
  38. public function getText() {
  39. return $this->text;
  40. }
  41. public function getLevel() {
  42. return $this->level;
  43. }
  44. public function queryString() {
  45. $head = "watermark/$this->markType";
  46. $res = "";
  47. if($this->type){
  48. $res .= $this->type;
  49. }
  50. if($this->image){
  51. $res .= $this->image;
  52. }
  53. if($this->text){
  54. $res .= $this->text;
  55. }
  56. if($this->level){
  57. $res .= $this->level;
  58. }
  59. if($res){
  60. $res = $head . $res;
  61. }
  62. return $res;
  63. }
  64. public function resetRule() {
  65. $this->markType = 3;
  66. $this->type = "";
  67. $this->image = "";
  68. $this->text = "";
  69. $this->level = "";
  70. }
  71. }