1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* This file is part of the O2System Framework package.
|
4
|
|
|
*
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE
|
6
|
|
|
* file that was distributed with this source code.
|
7
|
|
|
*
|
8
|
|
|
* @author Steeve Andrian Salim
|
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim
|
10
|
|
|
*/
|
11
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------
|
13
|
|
|
|
14
|
|
|
namespace O2System\Image\Watermark;
|
15
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------
|
17
|
|
|
|
18
|
|
|
use O2System\Image\Abstracts\AbstractWatermark;
|
19
|
|
|
|
20
|
|
|
/**
|
21
|
|
|
* Class Overlay
|
22
|
|
|
*
|
23
|
|
|
* @package O2System\Image\Watermark
|
24
|
|
|
*/
|
25
|
|
|
class Overlay extends AbstractWatermark
|
26
|
|
|
{
|
27
|
|
|
/**
|
28
|
|
|
* Overlay::$imagePath
|
29
|
|
|
*
|
30
|
|
|
* Overlay image path.
|
31
|
|
|
*
|
32
|
|
|
* @var string
|
33
|
|
|
*/
|
34
|
|
|
protected $imagePath;
|
35
|
|
|
|
36
|
|
|
/**
|
37
|
|
|
* Overlay::$imageScale
|
38
|
|
|
*
|
39
|
|
|
* Overlay image scale.
|
40
|
|
|
*
|
41
|
|
|
* @var int
|
42
|
|
|
*/
|
43
|
|
|
protected $imageScale;
|
44
|
|
|
|
45
|
|
|
// ------------------------------------------------------------------------
|
46
|
|
|
|
47
|
|
|
/**
|
48
|
|
|
* Overlay::getImagePath
|
49
|
|
|
*
|
50
|
|
|
* Gets overlay image path.
|
51
|
|
|
*
|
52
|
|
|
* @return string
|
53
|
|
|
*/
|
54
|
|
|
public function getImagePath()
|
55
|
|
|
{
|
56
|
|
|
return $this->imagePath;
|
57
|
|
|
}
|
58
|
|
|
|
59
|
|
|
// ------------------------------------------------------------------------
|
60
|
|
|
|
61
|
|
|
/**
|
62
|
|
|
* Overlay::setImagePath
|
63
|
|
|
*
|
64
|
|
|
* Sets overlay image path.
|
65
|
|
|
*
|
66
|
|
|
* @param string $imagePath
|
67
|
|
|
*
|
68
|
|
|
* @return static
|
69
|
|
|
*/
|
70
|
|
|
public function setImagePath($imagePath)
|
71
|
|
|
{
|
72
|
|
|
if (is_file($imagePath)) {
|
73
|
|
|
$this->imagePath = realpath($imagePath);
|
74
|
|
|
}
|
75
|
|
|
|
76
|
|
|
return $this;
|
77
|
|
|
}
|
78
|
|
|
|
79
|
|
|
// ------------------------------------------------------------------------
|
80
|
|
|
|
81
|
|
|
/**
|
82
|
|
|
* Overlay::getImageScale
|
83
|
|
|
*
|
84
|
|
|
* Gets overlay image scale.
|
85
|
|
|
*
|
86
|
|
|
* @return int|bool
|
87
|
|
|
*/
|
88
|
|
|
public function getImageScale()
|
89
|
|
|
{
|
90
|
|
|
if ( ! is_null($this->imageScale)) {
|
|
|
|
|
91
|
|
|
return $this->imageScale;
|
92
|
|
|
}
|
93
|
|
|
|
94
|
|
|
return false;
|
95
|
|
|
}
|
96
|
|
|
|
97
|
|
|
// ------------------------------------------------------------------------
|
98
|
|
|
|
99
|
|
|
/**
|
100
|
|
|
* Overlay::setImageScale
|
101
|
|
|
*
|
102
|
|
|
* Sets overlay image scale.
|
103
|
|
|
*
|
104
|
|
|
* @param int $scale
|
105
|
|
|
*
|
106
|
|
|
* @return $this
|
107
|
|
|
*/
|
108
|
|
|
public function setImageScale($scale)
|
109
|
|
|
{
|
110
|
|
|
$this->imageScale = (int)$scale;
|
111
|
|
|
|
112
|
|
|
return $this;
|
113
|
|
|
}
|
114
|
|
|
} |