-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolorpreview.php
More file actions
102 lines (71 loc) · 1.71 KB
/
colorpreview.php
File metadata and controls
102 lines (71 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* Created by Benjaco
*/
$fil = 'uploadfolder/' . $_GET['fil'];
$sorthvid = $_GET["ss"];
$kontrast = $_GET["k"];
$lysbalance = $_GET["b"];
$fileinfomation = getimagesize($fil);
$width = $fileinfomation[0];
$height = $fileinfomation[1];
$mime = $fileinfomation["mime"];
header('Content-Type:'.$mime);
$type = substr(strrchr($mime, '/'), 1);
$img = false;
switch ($type) {
case 'jpeg':
$img = imagecreatefromjpeg($fil);
$new_image_ext = 'jpg';
break;
case 'png':
$img = imagecreatefrompng($fil);
$new_image_ext = 'png';
imagealphablending($img, false);
imagesavealpha($img, true);
break;
case 'bmp':
$img = imagecreatefrombmp($fil);
$new_image_ext = 'bmp';
break;
case 'gif':
$img = imagecreatefromgif($fil);
$new_image_ext = 'gif';
break;
case 'vnd.wap.wbmp':
$img = imagecreatefromwbmp($fil);
$new_image_ext = 'bmp';
break;
case 'xbm':
$img = imagecreatefromxbm($fil);
$new_image_ext = 'xbm';
break;
default:
$img = imagecreatefromjpeg($fil);
$new_image_ext = 'jpg';
}
if ($sorthvid == "1") {
imagefilter($img, IMG_FILTER_GRAYSCALE);
}
imagefilter($img, IMG_FILTER_BRIGHTNESS, $lysbalance);
imagefilter($img, IMG_FILTER_CONTRAST, $kontrast);
switch ($type) {
case 'jpeg':
imagejpeg($img);
break;
case 'png':
imagepng($img);
break;
case 'bmp':
imagebmp($img);
break;
case 'gif':
imagegif($img);
break;
case 'vnd.wap.wbmp':
imagewbmp($img);
break;
default:
imagejpeg($img);
}
imagedestroy($img);