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
19000f5d
Commit
19000f5d
authored
Mar 31, 2022
by
Okthane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m
parent
5ee8f950
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
46 deletions
+32
-46
761871ef6ff89cf49dfeab2501d068d2_largeNO-BG.png
img_bg/761871ef6ff89cf49dfeab2501d068d2_largeNO-BG.png
+0
-0
pierremarqueNO-BG.png
img_bg/pierremarqueNO-BG.png
+0
-0
severinedemarqueNO-BG.png
img_bg/severinedemarqueNO-BG.png
+0
-0
index.php
index.php
+4
-7
script.js
script.js
+23
-36
761871ef6ff89cf49dfeab2501d068d2_large.jpg
temp/761871ef6ff89cf49dfeab2501d068d2_large.jpg
+0
-0
hadoux.jpeg
temp/hadoux.jpeg
+0
-0
upload.php
upload.php
+5
-3
No files found.
img_bg/761871ef6ff89cf49dfeab2501d068d2_largeNO-BG.png
0 → 100644
View file @
19000f5d
126 KB
img_bg/pierremarqueNO-BG.png
0 → 100644
View file @
19000f5d
152 KB
img_bg/severinedemarqueNO-BG.png
0 → 100644
View file @
19000f5d
163 KB
index.php
View file @
19000f5d
...
@@ -55,11 +55,8 @@
...
@@ -55,11 +55,8 @@
<img
name =
"im-ID"
id=
"img-ID"
src=
""
height=
"150em"
/>
<img
name =
"im-ID"
id=
"img-ID"
src=
""
height=
"150em"
/>
</div>
</div>
<div
id=
conditions
class=
"col-md-3 my-5 d-flex justify-content-center"
>
<div
id=
conditions
class=
"col-md-3 my-5 d-flex justify-content-center"
>
<ul>
<ul
class=
"list-group"
>
<li
id=
"li-oneface"
>
Un seul visage
<span></span></li>
<li
id=
"li-oneface"
class=
"list-group-item list-group-item-secondary"
>
Un seul visage
<span></span></li>
<li
id=
"li-format"
>
Format correct
<span></span></li>
<li
id=
"li-dimensons"
>
Format correct
<span></span></li>
<li
id=
"li-poids"
>
Poids
<span></span></li>
</ul>
</ul>
</div>
</div>
<div
class=
"col-md-3 my-auto d-flex justify-content-center"
>
<div
class=
"col-md-3 my-auto d-flex justify-content-center"
>
...
@@ -73,11 +70,11 @@
...
@@ -73,11 +70,11 @@
<form
id =
"form"
action=
""
method=
""
enctype=
"multipart/form-data"
>
<form
id =
"form"
action=
""
method=
""
enctype=
"multipart/form-data"
>
<!-- <label for="fileUpload">Fichier:</label> -->
<!-- <label for="fileUpload">Fichier:</label> -->
<div
class=
"div-btn-form"
>
<div
class=
"div-btn-form"
>
<input
type=
"file"
name=
"photo"
id=
"fileUpload"
required=
"required"
class=
"btn-form"
accept=
"image/png, image/jpeg"
>
<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> -->
<!-- <button onclick="defaultBtnActive()" class="btn-form" id="custom-fileUpload">Choisissez une photo</button> -->
</div>
</div>
<div
class=
"div-btn-form"
>
<div
class=
"div-btn-form"
>
<input
id=
"btnSubmit"
type=
"submit"
name=
"submit"
value=
"Vérifier"
class=
"btn
-form
"
>
<input
id=
"btnSubmit"
type=
"submit"
name=
"submit"
value=
"Vérifier"
class=
"btn
btn-secondary"
style=
"background-color:#00b8de;width: 50%
"
>
</div>
</div>
</form>
</form>
<script>
<script>
...
...
script.js
View file @
19000f5d
...
@@ -16,6 +16,8 @@ const canva = "canvas";
...
@@ -16,6 +16,8 @@ const canva = "canvas";
const
idConsole
=
"span-status"
;
var
Console
;
const
idConsole
=
"span-status"
;
var
Console
;
const
idFileUpload
=
"fileUpload"
;
var
inputFileUpload
;
const
idFileUpload
=
"fileUpload"
;
var
inputFileUpload
;
const
idCustomFileUpload
=
"custom-fileUpload"
;
var
btnCustomFileUpload
;
const
idCustomFileUpload
=
"custom-fileUpload"
;
var
btnCustomFileUpload
;
const
idBtnSubmit
=
"btnSubmit"
;
var
btnSubmit
;
const
idBtnSubmit
=
"btnSubmit"
;
var
btnSubmit
;
...
@@ -30,6 +32,7 @@ var errorRemoveBackGround = true;
...
@@ -30,6 +32,7 @@ var errorRemoveBackGround = true;
var
unSeulVisage
=
false
;
var
unSeulVisage
=
false
;
var
format_correct
=
false
;
var
format_correct
=
false
;
const
id_li_OneFace
=
"li-oneface"
;
var
li_OneFace
;
// SCRIPT ====================================================================================
// SCRIPT ====================================================================================
...
@@ -47,6 +50,7 @@ $(document).ready(function(){
...
@@ -47,6 +50,7 @@ $(document).ready(function(){
btnSubmit
=
$
(
"#"
+
idBtnSubmit
);
btnSubmit
=
$
(
"#"
+
idBtnSubmit
);
btnCancel
=
$
(
"#"
+
idCancel
);
btnCancel
=
$
(
"#"
+
idCancel
);
Console
=
$
(
"#"
+
idConsole
);
Console
=
$
(
"#"
+
idConsole
);
li_OneFace
=
$
(
"#"
+
id_li_OneFace
);
//Si l'on change la photo,
//Si l'on change la photo,
...
@@ -83,10 +87,12 @@ $(document).ready(function(){
...
@@ -83,10 +87,12 @@ $(document).ready(function(){
src
=
data
[
'src'
];
src
=
data
[
'src'
];
console
.
log
(
'src'
);
console
.
log
(
'src'
);
errorFormat
=
data
[
'error'
];
errorFormat
=
data
[
'error'
];
Console
.
empty
();
var
message
=
data
[
'message'
]
Console
.
append
(
data
[
'message'
]);
if
(
!
errorFormat
){
format_correct
=
true
;
format_correct
=
true
;
photoDetourage
(
errorFormat
,
formData
);
photoDetourage
(
formData
);
}
else
{
alert
(
message
)}
})
})
});
});
...
@@ -139,7 +145,9 @@ $(document).ready(function(){
...
@@ -139,7 +145,9 @@ $(document).ready(function(){
<h3>Votre adresse électronique sera
${
mailCalcule
}
, vous recevrez votre mot de passe dans les 24 heures.</h3>
<h3>Votre adresse électronique sera
${
mailCalcule
}
, vous recevrez votre mot de passe dans les 24 heures.</h3>
</div>
</div>
<div class = "container">
<div class = "container">
<button type="button" id="valide-mail" style="align-items:start">Ok c'est bon !</button>
<form action="" method="" onsubmit="event.preventDefault();sendMail()">
<input type="submit" id="valide-mail" value="Ok c'est bon !" class="btn btn-secondary" style="background-color:#00b8de">
</form>
</div>
</div>
`
`
);
);
...
@@ -155,7 +163,8 @@ $(document).ready(function(){
...
@@ -155,7 +163,8 @@ $(document).ready(function(){
function
sendMail
(){
function
sendMail
(){
console
.
log
(
$
(
"input[name=
\"
mail
\"
]:checked"
).
val
());
console
.
log
(
$
(
"input[name=
\"
mail
\"
]:checked"
).
val
());
var
mail
=
$
(
"input[name=
\"
mail
\"
]:checked"
).
val
();
var
mail
=
$
(
"input[name=
\"
mail
\"
]:checked"
).
val
();
if
(
unSeulVisage
&&
format_correct
){
console
.
log
(
"unSeulVisage: "
+
unSeulVisage
+
"
\n
format_correct: "
+
format_correct
);
if
(
unSeulVisage
&&
format_correct
){
$
.
ajax
({
$
.
ajax
({
url
:
URL_CHOOSE_MAIL
,
url
:
URL_CHOOSE_MAIL
,
method
:
'POST'
,
method
:
'POST'
,
...
@@ -170,10 +179,10 @@ function sendMail(){
...
@@ -170,10 +179,10 @@ function sendMail(){
// window.close();
// window.close();
}
}
async
function
photoDetourage
(
errorFormat
,
formData
){
async
function
photoDetourage
(
formData
){
await
findFaces
(
ID
);
await
findFaces
(
ID
);
console
.
log
(
"await"
)
console
.
log
(
"await"
)
;
if
(
!
errorFormat
){
if
(
unSeulVisage
){
$
.
ajax
({
$
.
ajax
({
//url de la requête
//url de la requête
url
:
URL_DETOURAGE
,
url
:
URL_DETOURAGE
,
...
@@ -193,7 +202,8 @@ async function photoDetourage(errorFormat, formData){
...
@@ -193,7 +202,8 @@ async function photoDetourage(errorFormat, formData){
//Affichage de la photo
//Affichage de la photo
$
(
"#img-ID2"
).
attr
(
'src'
,
data
[
'src'
]);
$
(
"#img-ID2"
).
attr
(
'src'
,
data
[
'src'
]);
})
})
}
}
}
}
async
function
findFaces
(
idImage
)
{
async
function
findFaces
(
idImage
)
{
...
@@ -213,38 +223,15 @@ async function findFaces(idImage) {
...
@@ -213,38 +223,15 @@ async function findFaces(idImage) {
$
(
"#"
+
idStatut
).
append
(
predictions
.
length
+
" face(s) found!"
);
$
(
"#"
+
idStatut
).
append
(
predictions
.
length
+
" face(s) found!"
);
if
(
predictions
.
length
==
1
){
if
(
predictions
.
length
==
1
){
$
(
"#li-oneface"
).
css
(
'color'
,
'green'
);
$
(
"#li-oneface"
).
css
(
'color'
,
'green'
);
li_OneFace
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);
unSeulVisage
=
true
;
unSeulVisage
=
true
;
}
}
else
{
$
(
"#li-oneface"
).
css
(
'color'
,
'red'
);}
else
{
li_OneFace
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);}
// const canvas = document.getElementById(canva);
// canvas.width = img.width;
// canvas.height = img.height;
// const ctx = canvas.getContext("2d");
// ctx.fillStyle = "rgba(250,225,6,0.5)";
// for (let i = 0; i < predictions.length; i++)
// {
// const start = predictions[i].topLeft;
// const end = predictions[i].bottomRight;
// const size = [end[0] - start[0], end[1] - start[1]];
// ctx.fillRect(start[0], start[1], size[0], size[1]);
// var landmark;
// for (let j = 0; j < predictions[i].landmarks.length; j++)
// {
// landmark = predictions[i].landmarks[j];
// ctx.beginPath();
// ctx.arc(landmark[0],landmark[1], 1, 0, 2*Math.PI,false);
// ctx.fill();
// ctx.lineWidth = 1;
// ctx.strokeStyle = '#ff0000';
// ctx.stroke();
// }
// }
}
}
else
{
else
{
$
(
"#"
+
idStatut
).
empty
();
$
(
"#"
+
idStatut
).
empty
();
$
(
"#"
+
idStatut
).
append
(
"No Face(s) Found"
);
$
(
"#"
+
idStatut
).
append
(
"No Face(s) Found"
);
$
(
"#li-oneface"
).
css
(
'color'
,
'red'
);
li_OneFace
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);
}
}
btnSubmit
.
prop
(
'disabled'
,
false
);
btnSubmit
.
prop
(
'disabled'
,
false
);
btnCustomFileUpload
.
prop
(
'disabled'
,
false
);
btnCustomFileUpload
.
prop
(
'disabled'
,
false
);
...
...
temp/761871ef6ff89cf49dfeab2501d068d2_large.jpg
0 → 100644
View file @
19000f5d
489 KB
temp/hadoux.jpeg
0 → 100644
View file @
19000f5d
14 KB
upload.php
View file @
19000f5d
...
@@ -11,9 +11,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
...
@@ -11,9 +11,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
if
(
isset
(
$_FILES
[
"photo"
])
&&
$_FILES
[
"photo"
][
"error"
]
==
0
)
if
(
isset
(
$_FILES
[
"photo"
])
&&
$_FILES
[
"photo"
][
"error"
]
==
0
)
{
{
$allowed
=
array
(
$allowed
=
array
(
"jpg"
=>
"image/jpeg"
,
"jpg"
=>
"image/jpeg"
,
"jpeg"
=>
"image/jpeg"
,
"png"
=>
"image/png"
,
"png"
=>
"image/png"
,
"PNG"
=>
"image/PNG"
"PNG"
=>
"image/PNG"
,
"JPG"
=>
"image/JPG"
);
);
$filename
=
htmlspecialchars
(
trim
(
$_FILES
[
"photo"
][
"name"
]));
// évite les noms de fichiers trop exotiques
$filename
=
htmlspecialchars
(
trim
(
$_FILES
[
"photo"
][
"name"
]));
// évite les noms de fichiers trop exotiques
$newfilename
=
$filename
;
$newfilename
=
$filename
;
...
@@ -60,7 +62,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
...
@@ -60,7 +62,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
}
}
else
else
{
{
$message
=
"Error: La taille du fichier est supérieure à la limite autorisée
.
"
;
$message
=
"Error: La taille du fichier est supérieure à la limite autorisée
(1 Mo)
"
;
$errorType
=
"poids_taille"
;
$errorType
=
"poids_taille"
;
}
}
}
}
...
...
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