-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphoto.php
185 lines (147 loc) · 5.74 KB
/
photo.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
use src\php\classes\User\User;
use src\php\classes\Cards\Cards;
use src\php\classes\Image\Image;
include_once("bootstrap.php");
try {
$user = new User();
$currentUserId = $_SESSION["userId"];
$currentUser = $user->getUserInfo($currentUserId);
} catch (\Throwable $th) {
$error = $th->getMessage();
}
$images = Image::getFeedImage();
require 'vendor/autoload.php';
use Google\Cloud\Vision\V1\Feature\Type;
use Google\Cloud\Vision\V1\ImageAnnotatorClient;
use Google\Cloud\Vision\V1\Likelihood;
use Google\Cloud\Vision\VisionClient;
putenv('GOOGLE_APPLICATION_CREDENTIALS=key.json');
$vision = new VisionClient();
//$imageResource = "upload/card". $_SESSION["userId"]. ".png";
$imageResource = fopen( "upload/card". $_SESSION["userId"]. ".png", 'r');
$image = $vision->image($imageResource, [ 'text' ]);
$annotation = $vision->annotate($image);
$text = $annotation->text()[1];
//var_dump($text);
//var_dump($vision);
if (!empty($_POST["cardName"])) {
try {
$card = new Cards();
$card->setCollectionId($_POST['id']);
$card->setCard_name($_POST["cardName"]);
$card->setCard_price($_POST["cardPrice"]);
$card->setCard_image($_POST["cardImage"]);
$card->saveCards();
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
include_once("header2.inc.php");
include_once("navbar.inc.php");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="css/add_card.css">
<link rel="stylesheet" href="src/css/style.css">
<title>Epicards | Find card</title>
</head>
<nav>
</nav>
<body>
<div class="input-field col s12">
<div class="search">
<input type="text" id="name-input" placeholder="search name" name="current-search" value="<?php echo htmlspecialchars( $text->description()); ?>" class="form_input card_input">
<button id="search-button" class="search_btn"><img src="assets/search_icon.svg" alt="search button" class="search_btn">
<p class="hide_text">hi</p>
</button>
</div>
<select class="browser-default" id="generation-search" style="display:none ;">
<option value="">Choose your option</option>
<option value="generation/1">1</option>
<option value="generation/2">2</option>
<option value="generation/3">3</option>
<option value="generation/4">4</option>
<option value="generation/5">5</option>
<option value="generation/6">6</option>
<option value="generation/7">7</option>
</select>
<select class="browser-default" id="type-search" style="display:none ;">
<option value="">Choose your option</option>
<option value="Grass">Grass</option>
<option value="Fire">Fire</option>
<option value="Water">Water</option>
<option value="Lightning">Lightning</option>
<option value="Psychic">Psychic</option>
<option value="Fighting">Fighting</option>
<option value="Darkness">Darkness</option>
<option value="Metal">Metal</option>
<option value="Dragon">Dragon</option>
<option value="Fairy">Fairy</option>
<option value="Colorless">Colorless</option>
</select>
</div>
</ul>
</div>
<div class="card_scroll">
<div>
<div class="col s12 m8 l9">
<!-- Teal page content -->
<div class="row responsive-img" id="pokeResults">
</div>
</div>
</div>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span onclick="document.getElementById('myModal').style.display='none'" class="close">× close</span>
<h4 id="modal-card-name"></h4>
<p id="modal-card-type"></p>
<table class="responsive-table highlight">
<p id="test"></p>
<tbody style="display: none;">
<tr>
<td id="priceH">Holofoil Market Price</td>
<td id="modal-HoloFoil-price"></td>
</tr>
<tr>
<td id="priceR">Reverse Holofoil Market Price</td>
<td id="modal-reverseHolofoil-price"></td>
</tr>
<tr>
<td>Normal Market Price</td>
<td id="modal-normal-price"></td>
</tr>
</tbody>
</table>
<img class="responsive-img" src="" alt="" id="modal-card-image">
<form action="" method="">
<input id="addCard-data" type="hidden" value="" name="cardName"></input>
<input id="addCard-price" type="hidden" value="" name="cardPrice"></input>
<input id="addCard-image" type="hidden" value="" name="cardImage"></input>
<input type="hidden" value="<?php echo $_POST['id'] ?>" name="id"></input>
<input type="hidden" value="<?php echo $_POST['type'] ?>" name="type"></input>
<button id="card-saver" type="submit" class="btn">add card</button>
</form>
</div>
</div>
</div>
<!-- The Modal -->
<?php if ($_POST['type'] == "pokemon") {
echo '<script src="src/js/pokesearch.js"></script>';
} elseif ($_POST['type'] == "yugioh") {
echo '<script src="src/js/yugioh.js"></script>';
} else {
echo '<script src="src/js/mtg.js"></script>';
}
?>
</body>
</html>