-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
47 lines (36 loc) · 1.02 KB
/
search.php
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
<?php
session_start();
$title = 'Search';
require_once('./config/config.php');
require_once('./elements/helpers.php');
if (empty($_GET)) {
header('Location: /index.php');
exit();
}
$color = htmlspecialchars($_GET['color']);
$r = hexdec(substr($color,0,2));
$g = hexdec(substr($color,2,2));
$b = hexdec(substr($color,4,2));
$foregroundColor = ($r + $g + $b) < 550 ? 'white' : 'black';
?>
<!DOCTYPE html>
<html>
<?php include('./elements/header.php'); ?>
<body>
<?php include('./elements/nav.php'); ?>
<section class="section">
<div class="box container column is-one-quarter" style="margin-bottom: 3em">
<div class="colorFinder" style="background-color:#<?php echo $color; ?>; color: <?php echo $foregroundColor;?>">
<?php echo "#$color"; ?> | <?php echo "rgb($r, $g, $b)"; ?>
</div>
</div>
<div class="columns is-multiline is-flex listing">
<?php
$images = Image::getImagesByColor($color);
foreach ($images as $img)
echo itemImage($img);
?>
</div>
</section>
</body>
</html>