Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ImageWatermark.php
1<?php
10
12{
13 const SIZE_REAL = "real";
14
15 const
16 MODE_REPEAT = 'repeat',
17 MODE_EXACT = 'exact',
18 MODE_RESIZE = 'resize';
19
20 protected $imageFile;
22 protected $alpha = 1.0;
23
28 public function __construct($imageFile = null)
29 {
30 parent::__construct();
31
32 $this->imageFile = $imageFile;
33 }
34
35 public function getRatio()
36 {
37 if($this->ratio === null)
38 {
39 if($this->size == static::SIZE_BIG)
40 {
41 return 0.75;
42 }
43 if($this->size == static::SIZE_SMALL)
44 {
45 return 0.20;
46 }
47 if($this->size == static::SIZE_REAL)
48 {
49 return 1.00;
50 }
51 //static::SIZE_MEDIUM
52 return 0.50;
53 }
54 return $this->ratio;
55 }
56
60 public function getMode()
61 {
62 return $this->mode;
63 }
64
69 public function setMode($mode)
70 {
71 $this->mode = $mode;
72 return $this;
73 }
74
78 public function getAlpha()
79 {
80 return $this->alpha;
81 }
82
87 public function setAlpha($alpha)
88 {
89 $this->alpha = (float)$alpha;
90 return $this;
91 }
92
96 public function getImageFile()
97 {
98 return $this->imageFile;
99 }
100
105 public function setImageFile($imageFile)
106 {
107 $this->imageFile = $imageFile;
108 return $this;
109 }
110}