-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploads.php
116 lines (96 loc) · 2.96 KB
/
uploads.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
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
<?php
require_once 'core/init.php';
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(Image::exist('image'))
{
if(Image::size('image')<=5000000)
{
$image = addslashes($_FILES['image']['tmp_name']);
$name = addslashes($_FILES['image']['name']);
$image = file_get_contents($image);
$image = base64_encode($image);
pretag(Image::getImage('image')."<br>");
echo '<img class="th" height="400" width="300" src="data:image;base64,'.Image::getImage('image').'"><br>';
echo Image::name('image')."<br>";
echo Image::size('image')."<br>";
echo Image::getImage('image')."<br>";
pretag(getimagesize($_FILES['image']['tmp_name'])[3]);
echo "\n<br />".Image::type('image');
/*saveImage($name, $image);*/
}
else{
echo "Image is too Large";
}
}
else
{
echo "please select an image";
}
}
function saveImage($name, $image)
{
$db = new Database();
$result = $db->insert('images', [
'name' => $name,
'image' => $image
]);
if($result)
{
echo "<br>image Uploaded.";
// header('Location: uploads.php');
}
else
{
echo "<br>Image not uploaded.";
}
}
function displayImage()
{
$db = new Database();
//$db->where('id', 1);
$rows = $db->get('images');
foreach($rows as $row)
{
// echo "{$row['name']}";
echo '<img class="th" height="100" width="100" src="data:image;base64,'.$row['image'].'">';
}
}
?>
<!DOCTYPE html>
<!--[if IE 9]><html class="lt-ie10" lang="en" > <![endif]-->
<html class="no-js" lang="en" >
<head>
<meta charset="utf-8">
<!-- If you delete this meta tag World War Z will become a reality -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Foundation 5</title>
<!-- If you are using the CSS version, only link these 2 files, you may add app.css to use for your overrides if you like -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="./public/css/foundation.css">
<!-- If you are using the gem version, you need this only -->
<link rel="stylesheet" href="css/app.css">
<script src="js/vendor/modernizr.js"></script>
</head>
<body>
<div class="row">
<div class="large-6 large-centered columns" >
<form method="POST" action="" enctype="multipart/form-data">
<input type="file" name="image" value="Image">
<input type="submit" name="submit" class="button small round">
<div>
<em>Date of Birth</em><input type="date" name="dob"/>
</div>
</form>
</div>
<div class="large-12 column">
<?php //displayImage(); ?>
</div>
</div>
<script src="js/vendor/jquery.js"></script>
<script src="js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>