-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
139 lines (122 loc) · 5.76 KB
/
edit.php
File metadata and controls
139 lines (122 loc) · 5.76 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
session_start();
require_once('./elements/header_allowed.php');
require_once('./config/config.php');
require_once('./elements/helpers.php');
if (empty($_GET)) {
header('Location: /profile.php');
exit();
}
$img = Image::getImageByUserAndId($_GET['id'], $_SESSION['user']['id'], $_SESSION['user']['name']);
if (!$img) {
header('Location: /profile.php');
exit();
}
$filters = $_SESSION['image'][$_GET['id']] ?? [];
if (!empty($_POST)) {
if (!empty($_POST['quit_action'])) {
if ($_POST['quit_action'] == 'save')
$img->saveFilters($filters);
$_SESSION['image'][$_GET['id']] = null;
header('Location: /profile.php');
exit();
} else if (!empty($_POST['action'])) {
array_pop($filters);
} else {
foreach ($_POST as $key => $value) {
$filters[] = $key;
}
}
$_SESSION['image'][$_GET['id']] = $filters;
}
$title = 'Edit';
?>
<!DOCTYPE html>
<html>
<?php include('./elements/header.php'); ?>
<body>
<?php include('./elements/nav.php'); ?>
<section class="section">
<div class="column is-mobile is-half-desktop is-three-quarters-tablet container">
<div class="tile is-ancestor">
<div class="tile is-parent">
<article class="tile is-child notification is-info tool-panel">
<div class="content">
<p class="title" style="margin-bottom: 0px">Tools</p>
<hr style="margin: 10px"/>
<div class="content tools">
<form method="POST" action="">
<div class="item">
<button class="icon" type="submit" name="contrast_minus">
<i class="fa fa-adjust" aria-hidden="true" title="- Contrast"></i>
<i class="fa fa-minus" aria-hidden="true"></i>
</button>
<button class="icon" type="submit" name="contrast_plus">
<i class="fa fa-adjust" aria-hidden="true" title="+ Contrast"></i>
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</div>
<div class="item">
<button class="icon" type="submit" name="light_minus">
<i class="fa fa-sun-o" aria-hidden="true" title="- Light"></i>
<i class="fa fa-minus" aria-hidden="true"></i>
</button>
<button class="icon" type="submit" name="light_plus">
<i class="fa fa-sun-o" aria-hidden="true" title="+ Light"></i>
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</div>
<div class="item">
<button class="icon" type="submit" name="sepia">
<i class="fa fa-square sepia" aria-hidden="true" title="Sépia"></i>
</button>
<button class="icon" type="submit" name="grayscale">
<i class="fa fa-square grayscale" aria-hidden="true" title="Gray scale"></i>
</button>
</div>
<div class="item">
<button class="icon" type="submit" name="gauss">
<i class="fa fa-square blur" aria-hidden="true" title="Gauss"></i>
</button>
<button class="icon" type="submit" name="edge">
<i class="fa fa-square-o" aria-hidden="true" title="Edge"></i>
</button>
</div>
<div class="item" style="margin: 25px 0px">
<button class="icon" type="submit" name="action" value="back">
<i class="fa fa-undo" aria-hidden="true" title="Back"></i>
</button>
</div>
<div class="item" style="margin: 10px 0px">
<button class="button is-danger" type="submit" name="quit_action" value="unsave">
<span class="icon" type="submit" name="save">
<i class="fa fa-close" aria-hidden="true"></i>
</span>
</button>
<button class="button is-success" type="submit" name="quit_action" value="save">
<span class="icon" type="submit" name="save">
<i class="fa fa-save" aria-hidden="true"></i>
</span>
</button>
</div>
</form>
</div>
</div>
</article>
</div>
<div class="tile is-vertical column is-9 is-mobile-9">
<div class="tile">
<div class="box">
<figure class="image">
<?php echo '<img src="data:image/jpg;base64,'. base64_encode($img->withFilters($filters)->getImageBlob()) . '"/>'; ?>
</figure>
<div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>