Grayscale   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Execute() 0 11 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
    use CloudControl\Cms\images\IMethod;
12
13
    class Grayscale extends IMethod
14
    {
15
        public function Execute($imageResource)
16
        {
17
            // Preserve transparency
18
            imagecolortransparent($imageResource, imagecolorallocatealpha($imageResource, 0, 0, 0, 127));
19
            imagealphablending($imageResource, false);
20
            imagesavealpha($imageResource, true);
21
22
            // Make grayscale
23
            imagefilter($imageResource, IMG_FILTER_GRAYSCALE);
24
25
            return $imageResource;
26
        }
27
    }
28
}