Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Projet ISIS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MARQUE Pierre
Projet ISIS
Commits
6f25c801
Commit
6f25c801
authored
May 03, 2022
by
Okthane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vesrion finale - Nouveaux commentaires
parent
287148b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
40 deletions
+31
-40
index.php
index.php
+1
-9
io.php
io.php
+5
-1
script.js
script.js
+22
-25
upload.php
upload.php
+3
-5
No files found.
index.php
View file @
6f25c801
...
...
@@ -81,13 +81,13 @@
<!-- <label for="fileUpload">Fichier:</label> -->
<div
class=
"div-btn-form"
>
<input
type=
"file"
name=
"photo"
id=
"fileUpload"
required=
"required"
class=
"btn-form"
accept=
"image/png, image/jpeg"
>
<!-- <button onclick="defaultBtnActive()" class="btn-form" id="custom-fileUpload">Choisissez une photo</button> -->
</div>
<div
class=
"div-btn-form"
>
<input
id=
"btnSubmit"
type=
"submit"
name=
"submit"
value=
"Vérifier"
class=
"btn btn-secondary"
style=
"background-color:#00b8de;width: 50%"
>
</div>
</form>
<script>
/**Ce script affiche la photo téléchargée sans */
const
inpFile
=
document
.
getElementById
(
"fileUpload"
);
const
previewImage
=
document
.
getElementById
(
"img-ID"
);
...
...
@@ -101,7 +101,6 @@
base64
=
get_base64
(
this
.
result
);
});
reader
.
readAsDataURL
(
file
);
// findFaces("img-ID");
}
inpFile
.
addEventListener
(
"change"
,
function
(){
const
file
=
inpFile
.
files
[
0
];
...
...
@@ -114,16 +113,9 @@
base64
=
get_base64
(
this
.
result
);
});
reader
.
readAsDataURL
(
file
);
// findFaces("img-ID");
}
});
// const defaultBtn = document.querySelector('#fileUpload');
// const customBtn = document.querySelector("#custom-fileUpload");
// function defaultBtnActive(){
// defaultBtn.click();
// }
</script>
<script
src=
"script.js"
></script>
</div>
...
...
io.php
View file @
6f25c801
<?php
// Fausse API qui reçoit le choix du mail
echo
json_encode
(
'ok'
);
?>
\ No newline at end of file
//TODO
?>
script.js
View file @
6f25c801
...
...
@@ -16,7 +16,6 @@ const idConsole = "span-status"; var Console;
var
base64
=
""
;
const
idFileUpload
=
"fileUpload"
;
var
inputFileUpload
;
const
idCustomFileUpload
=
"custom-fileUpload"
;
var
btnCustomFileUpload
;
const
idBtnSubmit
=
"btnSubmit"
;
var
btnSubmit
;
const
idStatut
=
"span-status"
;
...
...
@@ -38,7 +37,6 @@ $(document).ready(function(){
//Variables des éléments du DOM.
inputFileUpload
=
$
(
"#"
+
idFileUpload
);
btnCustomFileUpload
=
$
(
"#"
+
idCustomFileUpload
);
Img
=
$
(
"#"
+
ID
);
ImgBG
=
$
(
"#"
+
ID_bg
);
...
...
@@ -50,7 +48,6 @@ $(document).ready(function(){
li_taille
=
$
(
"#"
+
id_li_taille
);
//Récupération des données concernant l'étudiant & proposition des différentes addresses mail.
studentId
=
getParameter
(
window
.
location
.
href
);
$
.
ajax
({
...
...
@@ -60,16 +57,16 @@ $(document).ready(function(){
dataType
:
"json"
})
.
done
(
function
(
response
){
// let data = JSON.stringify(response);
// $("div#res").append(data);
// if(!data["atraiter"]){window.open(URL_END, '_self');
let
data
=
response
;
const
data
=
response
;
if
(
!
data
[
"atraiter"
]){
window
.
open
(
URL_END
,
'_self'
);}
console
.
log
(
data
);
let
prenom
=
data
[
'prenom'
];
let
nom
=
data
[
'nom'
];
let
mailCalcule
=
data
[
"mailCalcule"
];
let
mailsPossibles
=
data
[
"mailsPossibles"
];
const
prenom
=
data
[
'prenom'
];
const
nom
=
data
[
'nom'
];
const
mailCalcule
=
data
[
"mailCalcule"
];
const
mailsPossibles
=
data
[
"mailsPossibles"
];
/**Création du choix d'emails (si choix ) */
if
(
mailsPossibles
.
length
!=
0
)
{
...
...
@@ -137,7 +134,8 @@ $(document).ready(function(){
// La photo se nomme avec l'ID.
const
formData
=
new
FormData
();
formData
.
set
(
"photo"
,
file
,
studentId
+
"."
+
extension
);
//On modifie le nom de la photo -> ID de l'étudiant
formData
.
set
(
"photo"
,
file
,
studentId
+
"."
+
extension
);
//Requête pour vérifier l'intégrité du fichier, ses dimensions
...
...
@@ -179,14 +177,16 @@ $(document).ready(function(){
// FONCTIONS ================================================================================
/**
* Requête pour envoyer le mail choisi
*/
function
sendMail
(){
let
mail
=
$
(
"input[name=
\"
mail
\"
]:checked"
).
val
();
console
.
log
(
"unSeulVisage: "
+
unSeulVisage
+
"
\n
format_correct: "
+
format_correct
);
if
(
unSeulVisage
&&
format_correct
){
$
.
ajax
({
url
:
URL_CHOOSE_MAIL
,
url
:
URL_CHOOSE_MAIL
,
//=io.php
method
:
'POST'
,
data
:
'mail='
+
mail
,
...
...
@@ -205,7 +205,7 @@ async function photoDetourage(formData){
if
(
unSeulVisage
){
$
.
ajax
({
//url de la requête
url
:
URL_DETOURAGE
,
url
:
URL_DETOURAGE
,
//=removeBackGround2.php
method
:
'POST'
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
...
...
@@ -216,7 +216,6 @@ async function photoDetourage(formData){
processData
:
false
})
.
done
(
function
(
data
){
console
.
log
(
data
);
//Affichage de la photo
ImgBG
.
attr
(
'src'
,
data
[
'src'
]);
})
...
...
@@ -227,11 +226,10 @@ async function findFaces(idImage) {
// btnCustomFileUpload.prop('disabled',true);
$
(
"body"
).
css
(
"cursor"
,
"wait"
);
btnSubmit
.
prop
(
'disabled'
,
true
);
const
model
=
await
blazeface
.
load
();
// const img = ID;
const
img
=
document
.
getElementById
(
idImage
);
var
returnTensors
=
false
;
const
predictions
=
await
model
.
estimateFaces
(
img
,
returnTensors
);
const
model
=
await
blazeface
.
load
();
const
img
=
document
.
getElementById
(
idImage
);
const
returnTensors
=
false
;
const
predictions
=
await
model
.
estimateFaces
(
img
,
returnTensors
);
console
.
log
(
predictions
.
length
+
" visage(s) trouvés."
);
if
(
predictions
.
length
>
0
)
{
// for (let i = 0; i < predictions.length; i++) {
...
...
@@ -259,16 +257,15 @@ async function findFaces(idImage) {
li_OneFace
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);
}
btnSubmit
.
prop
(
'disabled'
,
false
);
btnCustomFileUpload
.
prop
(
'disabled'
,
false
);
$
(
"body"
).
css
(
"cursor"
,
""
);
}
function
getParameter
(
url
){
L
=
url
.
length
;
l
=
0
;
let
L
=
url
.
length
;
l
et
l
=
0
;
parameter
=
""
;
for
(
var
k
=
0
;
k
<
L
;
k
++
){
l
=
k
l
=
k
if
(
url
[
k
]
==
"?"
){
break
;}
}
while
(
url
[
l
]
!=
"="
)
...
...
upload.php
View file @
6f25c801
<?php
//dossier temporaitre pour les images
define
(
'PATH_TO_TEMP'
,
"temp"
);
// Vérifier si le formulaire a été soumis
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
{
...
...
@@ -29,7 +26,8 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
$ext
=
pathinfo
(
$filename
,
PATHINFO_EXTENSION
);
if
(
array_key_exists
(
$ext
,
$allowed
))
//die("Erreur : Veuillez sélectionner un format de fichier valide.");
{
// Vérifie le type MIME du fichier ATTENTION - VERIFIE SEULEMENT L'EXTENSION
// Vérifie le type MIME du fichier ATTENTION - VERIFIE SEULEMENT L'EXTENSION : En réalité le fichier n'est jamais
// téléchargé sur quelconque serveur, donc ce n'est pas grave.
if
(
in_array
(
$filetype
,
$allowed
))
{
$errorMIME
=
false
;
...
...
@@ -46,7 +44,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
"errorMIME"
=>
$errorMIME
,
"errorSize"
=>
$errorSize
,
"error"
=>
$error
,
//<----- Prend la valeur true (erreur!) ou false (ouf!)
"error"
=>
$error
,
//<----- Prend la valeur true (erreur!) ou false (ouf!)
);
echo
json_encode
(
$data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment