Passed
Push — master ( 9c6499...c22bc5 )
by Jens
04:52 queued 02:21
created

Grayscale   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Execute() 0 12 1
1
<?php
2
/**
3
 * Resize
4
 *
5
 * @Author: Platform 0
6
 * @Package: JNS MVC
7
 */
8
 
9
namespace CloudControl\Cms\images\methods
10
{
11
12
    use CloudControl\Cms\images\IMethod;
13
14
    class Grayscale extends IMethod
15
	{		
16
		public function Execute($imageResource)
17
		{			
18
			// Preserve transparency
19
			imagecolortransparent($imageResource, imagecolorallocatealpha($imageResource, 0, 0, 0, 127));
20
			imagealphablending($imageResource, false);
21
			imagesavealpha($imageResource, true);
22
			
23
			// Make grayscale
24
			imagefilter($imageResource, IMG_FILTER_GRAYSCALE);
25
			
26
			return $imageResource;
27
		}
28
	}
29
}