@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package WideImage |
|
23 | - **/ |
|
21 | + * @package WideImage |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * @package WideImage |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | static function create($width, $height) |
38 | 38 | { |
39 | - if ($width * $height <= 0 || $width < 0) |
|
40 | - throw new WideImage_InvalidImageDimensionException("Can't create an image with dimensions [$width, $height]."); |
|
39 | + if ($width * $height <= 0 || $width < 0) { |
|
40 | + throw new WideImage_InvalidImageDimensionException("Can't create an image with dimensions [$width, $height]."); |
|
41 | + } |
|
41 | 42 | |
42 | 43 | return new WideImage_PaletteImage(imagecreate($width, $height)); |
43 | 44 | } |
@@ -76,10 +77,11 @@ discard block |
||
76 | 77 | $width = $this->getWidth(); |
77 | 78 | $height = $this->getHeight(); |
78 | 79 | |
79 | - if ($trueColor) |
|
80 | - $new = WideImage_TrueColorImage::create($width, $height); |
|
81 | - else |
|
82 | - $new = WideImage_PaletteImage::create($width, $height); |
|
80 | + if ($trueColor) { |
|
81 | + $new = WideImage_TrueColorImage::create($width, $height); |
|
82 | + } else { |
|
83 | + $new = WideImage_PaletteImage::create($width, $height); |
|
84 | + } |
|
83 | 85 | |
84 | 86 | // copy transparency of source to target |
85 | 87 | if ($this->isTransparent()) |
@@ -106,8 +108,9 @@ discard block |
||
106 | 108 | $width = $this->getWidth(); |
107 | 109 | $height = $this->getHeight(); |
108 | 110 | $new = WideImage_TrueColorImage::create($width, $height); |
109 | - if ($this->isTransparent()) |
|
110 | - $new->copyTransparencyFrom($this); |
|
111 | + if ($this->isTransparent()) { |
|
112 | + $new->copyTransparencyFrom($this); |
|
113 | + } |
|
111 | 114 | imageCopy($new->getHandle(), $this->handle, 0, 0, 0, 0, $width, $height); |
112 | 115 | return $new; |
113 | 116 | } |
@@ -119,8 +122,9 @@ discard block |
||
119 | 122 | function getChannels() |
120 | 123 | { |
121 | 124 | $args = func_get_args(); |
122 | - if (count($args) == 1 && is_array($args[0])) |
|
123 | - $args = $args[0]; |
|
125 | + if (count($args) == 1 && is_array($args[0])) { |
|
126 | + $args = $args[0]; |
|
127 | + } |
|
124 | 128 | return WideImage_OperationFactory::get('CopyChannelsPalette')->execute($this, $args); |
125 | 129 | } |
126 | 130 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package WideImage |
|
23 | - **/ |
|
21 | + * @package WideImage |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * GDF font support class |
@@ -34,10 +34,11 @@ |
||
34 | 34 | |
35 | 35 | function __construct($face, $color) |
36 | 36 | { |
37 | - if (is_int($face) && $face >= 1 && $face <= 5) |
|
38 | - $this->font = $face; |
|
39 | - else |
|
40 | - $this->font = imageloadfont($face); |
|
37 | + if (is_int($face) && $face >= 1 && $face <= 5) { |
|
38 | + $this->font = $face; |
|
39 | + } else { |
|
40 | + $this->font = imageloadfont($face); |
|
41 | + } |
|
41 | 42 | $this->color = $color; |
42 | 43 | } |
43 | 44 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package WideImage |
|
23 | - **/ |
|
21 | + * @package WideImage |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * PS font support class |
@@ -38,16 +38,18 @@ |
||
38 | 38 | $this->handle = imagepsloadfont($file); |
39 | 39 | $this->size = $size; |
40 | 40 | $this->color = $color; |
41 | - if ($bgcolor === null) |
|
42 | - $this->bgcolor = $color; |
|
43 | - else |
|
44 | - $this->color = $color; |
|
41 | + if ($bgcolor === null) { |
|
42 | + $this->bgcolor = $color; |
|
43 | + } else { |
|
44 | + $this->color = $color; |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | |
47 | 48 | function writeText($image, $x, $y, $text, $angle = 0) |
48 | 49 | { |
49 | - if ($image->isTrueColor()) |
|
50 | - $image->alphaBlending(true); |
|
50 | + if ($image->isTrueColor()) { |
|
51 | + $image->alphaBlending(true); |
|
52 | + } |
|
51 | 53 | |
52 | 54 | imagepstext($image->getHandle(), $text, $this->handle, $this->size, $this->color, $this->bgcolor, $x, $y, 0, 0, $angle, 4); |
53 | 55 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package WideImage |
|
23 | - **/ |
|
21 | + * @package WideImage |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * TTF font support class |
@@ -42,8 +42,9 @@ |
||
42 | 42 | |
43 | 43 | function writeText($image, $x, $y, $text, $angle = 0) |
44 | 44 | { |
45 | - if ($image->isTrueColor()) |
|
46 | - $image->alphaBlending(true); |
|
45 | + if ($image->isTrueColor()) { |
|
46 | + $image->alphaBlending(true); |
|
47 | + } |
|
47 | 48 | |
48 | 49 | imagettftext($image->getHandle(), $this->size, $angle, $x, $y, $this->color, $this->face, $text); |
49 | 50 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package Internal/Operations |
|
23 | - **/ |
|
21 | + * @package Internal/Operations |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * Mirror operation class |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package Internal/Operations |
|
23 | - **/ |
|
21 | + * @package Internal/Operations |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * AutoCrop operation |
@@ -43,19 +43,22 @@ discard block |
||
43 | 43 | $margin = intval($margin); |
44 | 44 | |
45 | 45 | $rgb_threshold = intval($rgb_threshold); |
46 | - if ($rgb_threshold < 0) |
|
47 | - $rgb_threshold = 0; |
|
46 | + if ($rgb_threshold < 0) { |
|
47 | + $rgb_threshold = 0; |
|
48 | + } |
|
48 | 49 | |
49 | 50 | $pixel_cutoff = intval($pixel_cutoff); |
50 | - if ($pixel_cutoff <= 1) |
|
51 | - $pixel_cutoff = 1; |
|
51 | + if ($pixel_cutoff <= 1) { |
|
52 | + $pixel_cutoff = 1; |
|
53 | + } |
|
52 | 54 | |
53 | - if ($base_color === null) |
|
54 | - $rgb_base = $img->getRGBAt(0, 0); |
|
55 | - else |
|
55 | + if ($base_color === null) { |
|
56 | + $rgb_base = $img->getRGBAt(0, 0); |
|
57 | + } else |
|
56 | 58 | { |
57 | - if ($base_color < 0) |
|
58 | - return $img->copy(); |
|
59 | + if ($base_color < 0) { |
|
60 | + return $img->copy(); |
|
61 | + } |
|
59 | 62 | |
60 | 63 | $rgb_base = $img->getColorRGB($base_color); |
61 | 64 | } |
@@ -145,17 +148,21 @@ discard block |
||
145 | 148 | 'bottom' => $cut_rect['bottom'] + $margin |
146 | 149 | ); |
147 | 150 | |
148 | - if ($cut_rect['left'] < 0) |
|
149 | - $cut_rect['left'] = 0; |
|
151 | + if ($cut_rect['left'] < 0) { |
|
152 | + $cut_rect['left'] = 0; |
|
153 | + } |
|
150 | 154 | |
151 | - if ($cut_rect['top'] < 0) |
|
152 | - $cut_rect['top'] = 0; |
|
155 | + if ($cut_rect['top'] < 0) { |
|
156 | + $cut_rect['top'] = 0; |
|
157 | + } |
|
153 | 158 | |
154 | - if ($cut_rect['right'] >= $img->getWidth()) |
|
155 | - $cut_rect['right'] = $img->getWidth() - 1; |
|
159 | + if ($cut_rect['right'] >= $img->getWidth()) { |
|
160 | + $cut_rect['right'] = $img->getWidth() - 1; |
|
161 | + } |
|
156 | 162 | |
157 | - if ($cut_rect['bottom'] >= $img->getHeight()) |
|
158 | - $cut_rect['bottom'] = $img->getHeight() - 1; |
|
163 | + if ($cut_rect['bottom'] >= $img->getHeight()) { |
|
164 | + $cut_rect['bottom'] = $img->getHeight() - 1; |
|
165 | + } |
|
159 | 166 | |
160 | 167 | return $img->crop($cut_rect['left'], $cut_rect['top'], $cut_rect['right'] - $cut_rect['left'] + 1, $cut_rect['bottom'] - $cut_rect['top'] + 1); |
161 | 168 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package Internal/Operations |
|
23 | - **/ |
|
21 | + * @package Internal/Operations |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * CopyChannelsTrueColor operation class |
@@ -46,18 +46,24 @@ |
||
46 | 46 | $height = $img->getHeight(); |
47 | 47 | $copy = WideImage_TrueColorImage::create($width, $height); |
48 | 48 | |
49 | - if (count($channels) > 0) |
|
50 | - for ($x = 0; $x < $width; $x++) |
|
51 | - for ($y = 0; $y < $height; $y++) |
|
49 | + if (count($channels) > 0) { |
|
50 | + for ($x = 0; |
|
51 | + } |
|
52 | + $x < $width; $x++) { |
|
53 | + for ($y = 0; |
|
54 | + } |
|
55 | + $y < $height; $y++) |
|
52 | 56 | { |
53 | 57 | $RGBA = $img->getRGBAt($x, $y); |
54 | 58 | $newRGBA = $blank; |
55 | - foreach ($channels as $channel) |
|
56 | - $newRGBA[$channel] = $RGBA[$channel]; |
|
59 | + foreach ($channels as $channel) { |
|
60 | + $newRGBA[$channel] = $RGBA[$channel]; |
|
61 | + } |
|
57 | 62 | |
58 | 63 | $color = $copy->getExactColorAlpha($newRGBA); |
59 | - if ($color == -1) |
|
60 | - $color = $copy->allocateColorAlpha($newRGBA); |
|
64 | + if ($color == -1) { |
|
65 | + $color = $copy->allocateColorAlpha($newRGBA); |
|
66 | + } |
|
61 | 67 | |
62 | 68 | $copy->setColorAt($x, $y, $color); |
63 | 69 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package Internal/Operations |
|
23 | - **/ |
|
21 | + * @package Internal/Operations |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * GetMask operation class |
@@ -45,21 +45,25 @@ |
||
45 | 45 | $mask->alphaBlending(false); |
46 | 46 | $mask->saveAlpha(false); |
47 | 47 | |
48 | - for ($i = 0; $i <= 255; $i++) |
|
49 | - $greyscale[$i] = ImageColorAllocate($mask->getHandle(), $i, $i, $i); |
|
48 | + for ($i = 0; $i <= 255; $i++) { |
|
49 | + $greyscale[$i] = ImageColorAllocate($mask->getHandle(), $i, $i, $i); |
|
50 | + } |
|
50 | 51 | |
51 | 52 | imagefilledrectangle($mask->getHandle(), 0, 0, $width, $height, $greyscale[255]); |
52 | 53 | |
53 | 54 | $transparentColor = $image->getTransparentColor(); |
54 | 55 | $alphaToGreyRatio = 255 / 127; |
55 | - for ($x = 0; $x < $width; $x++) |
|
56 | - for ($y = 0; $y < $height; $y++) |
|
56 | + for ($x = 0; $x < $width; $x++) { |
|
57 | + for ($y = 0; |
|
58 | + } |
|
59 | + $y < $height; $y++) |
|
57 | 60 | { |
58 | 61 | $color = $image->getColorAt($x, $y); |
59 | - if ($color == $transparentColor) |
|
60 | - $rgba['alpha'] = 127; |
|
61 | - else |
|
62 | - $rgba = $image->getColorRGB($color); |
|
62 | + if ($color == $transparentColor) { |
|
63 | + $rgba['alpha'] = 127; |
|
64 | + } else { |
|
65 | + $rgba = $image->getColorRGB($color); |
|
66 | + } |
|
63 | 67 | imagesetpixel($mask->getHandle(), $x, $y, $greyscale[255 - round($rgba['alpha'] * $alphaToGreyRatio)]); |
64 | 68 | } |
65 | 69 | return $mask; |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * @author Gasper Kozak |
|
4 | - * @copyright 2007, 2008, 2009 |
|
3 | + * @author Gasper Kozak |
|
4 | + * @copyright 2007, 2008, 2009 |
|
5 | 5 | |
6 | 6 | This file is part of WideImage. |
7 | 7 | |
@@ -18,9 +18,8 @@ discard block |
||
18 | 18 | You should have received a copy of the GNU Lesser General Public License |
19 | 19 | along with WideImage; if not, write to the Free Software |
20 | 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
21 | - |
|
22 | - * @package Internal/Operations |
|
23 | - **/ |
|
21 | + * @package Internal/Operations |
|
22 | + **/ |
|
24 | 23 | |
25 | 24 | /** |
26 | 25 | * Unsharp filter |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $radius = $radius * 2; |
51 | 51 | if ($threshold > 255) $threshold = 255; |
52 | 52 | |
53 | - $radius = abs(round($radius)); // Only integers make sense. |
|
53 | + $radius = abs(round($radius)); // Only integers make sense. |
|
54 | 54 | if ($radius == 0) { |
55 | 55 | return $image; |
56 | 56 | } |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $blurred = $image->applyConvolution($matrix, 16, 0); |
67 | 67 | |
68 | - if($threshold > 0) { |
|
68 | + if ($threshold > 0) { |
|
69 | 69 | // Calculate the difference between the blurred pixels and the original |
70 | 70 | // and set the pixels |
71 | - for ($x = 0; $x < $image->getWidth(); $x++) { // each row |
|
72 | - for ($y = 0; $y < $image->getHeight(); $y++) { // each pixel |
|
71 | + for ($x = 0; $x < $image->getWidth(); $x++) { // each row |
|
72 | + for ($y = 0; $y < $image->getHeight(); $y++) { // each pixel |
|
73 | 73 | $rgbOrig = $image->getRGBAt($x, $y); |
74 | 74 | $rOrig = $rgbOrig["red"]; |
75 | 75 | $gOrig = $rgbOrig["green"]; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | else { |
103 | 103 | $w = $image->getWidth(); |
104 | 104 | $h = $image->getHeight(); |
105 | - for ($x = 0; $x < $w; $x++) { // each row |
|
106 | - for ($y = 0; $y < $h; $y++) { // each pixel |
|
105 | + for ($x = 0; $x < $w; $x++) { // each row |
|
106 | + for ($y = 0; $y < $h; $y++) { // each pixel |
|
107 | 107 | $rgbOrig = $image->getRGBAt($x, $y); |
108 | 108 | $rOrig = $rgbOrig["red"]; |
109 | 109 | $gOrig = $rgbOrig["green"]; |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $bBlur = $rgbBlur["blue"]; |
116 | 116 | |
117 | 117 | $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; |
118 | - if($rNew>255){$rNew=255;} |
|
119 | - elseif($rNew<0){$rNew=0;} |
|
118 | + if ($rNew > 255) {$rNew = 255; } |
|
119 | + elseif ($rNew < 0) {$rNew = 0; } |
|
120 | 120 | $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; |
121 | - if($gNew>255){$gNew=255;} |
|
122 | - elseif($gNew<0){$gNew=0;} |
|
121 | + if ($gNew > 255) {$gNew = 255; } |
|
122 | + elseif ($gNew < 0) {$gNew = 0; } |
|
123 | 123 | $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; |
124 | - if($bNew>255){$bNew=255;} |
|
125 | - elseif($bNew<0){$bNew=0;} |
|
124 | + if ($bNew > 255) {$bNew = 255; } |
|
125 | + elseif ($bNew < 0) {$bNew = 0; } |
|
126 | 126 | $rgbNew = array("red" => $rNew, "green" => $gNew, "blue" => $bNew, "alpha" => 0); |
127 | 127 | |
128 | 128 | $image->setRGBAt($x, $y, $rgbNew); |
@@ -44,11 +44,17 @@ discard block |
||
44 | 44 | function execute($image, $amount, $radius, $threshold) { |
45 | 45 | |
46 | 46 | // Attempt to calibrate the parameters to Photoshop: |
47 | - if ($amount > 500) $amount = 500; |
|
47 | + if ($amount > 500) { |
|
48 | + $amount = 500; |
|
49 | + } |
|
48 | 50 | $amount = $amount * 0.016; |
49 | - if ($radius > 50) $radius = 50; |
|
51 | + if ($radius > 50) { |
|
52 | + $radius = 50; |
|
53 | + } |
|
50 | 54 | $radius = $radius * 2; |
51 | - if ($threshold > 255) $threshold = 255; |
|
55 | + if ($threshold > 255) { |
|
56 | + $threshold = 255; |
|
57 | + } |
|
52 | 58 | |
53 | 59 | $radius = abs(round($radius)); // Only integers make sense. |
54 | 60 | if ($radius == 0) { |
@@ -98,8 +104,7 @@ discard block |
||
98 | 104 | } |
99 | 105 | } |
100 | 106 | } |
101 | - } |
|
102 | - else { |
|
107 | + } else { |
|
103 | 108 | $w = $image->getWidth(); |
104 | 109 | $h = $image->getHeight(); |
105 | 110 | for ($x = 0; $x < $w; $x++) { // each row |
@@ -115,14 +120,11 @@ discard block |
||
115 | 120 | $bBlur = $rgbBlur["blue"]; |
116 | 121 | |
117 | 122 | $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; |
118 | - if($rNew>255){$rNew=255;} |
|
119 | - elseif($rNew<0){$rNew=0;} |
|
123 | + if($rNew>255){$rNew=255;} elseif($rNew<0){$rNew=0;} |
|
120 | 124 | $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; |
121 | - if($gNew>255){$gNew=255;} |
|
122 | - elseif($gNew<0){$gNew=0;} |
|
125 | + if($gNew>255){$gNew=255;} elseif($gNew<0){$gNew=0;} |
|
123 | 126 | $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; |
124 | - if($bNew>255){$bNew=255;} |
|
125 | - elseif($bNew<0){$bNew=0;} |
|
127 | + if($bNew>255){$bNew=255;} elseif($bNew<0){$bNew=0;} |
|
126 | 128 | $rgbNew = array("red" => $rNew, "green" => $gNew, "blue" => $bNew, "alpha" => 0); |
127 | 129 | |
128 | 130 | $image->setRGBAt($x, $y, $rgbNew); |