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
Show 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 @@
<img
name =
"im-ID"
id=
"img-ID"
src=
""
height=
"150em"
/>
</div>
<div
id=
conditions
class=
"col-md-3 my-5 d-flex justify-content-center"
>
<ul>
<li
id=
"li-oneface"
>
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
class=
"list-group"
>
<li
id=
"li-oneface"
class=
"list-group-item list-group-item-secondary"
>
Un seul visage
<span></span></li>
</ul>
</div>
<div
class=
"col-md-3 my-auto d-flex justify-content-center"
>
...
...
@@ -77,7 +74,7 @@
<!-- <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
-form
"
>
<input
id=
"btnSubmit"
type=
"submit"
name=
"submit"
value=
"Vérifier"
class=
"btn
btn-secondary"
style=
"background-color:#00b8de;width: 50%
"
>
</div>
</form>
<script>
...
...
script.js
View file @
19000f5d
...
...
@@ -16,6 +16,8 @@ const canva = "canvas";
const
idConsole
=
"span-status"
;
var
Console
;
const
idFileUpload
=
"fileUpload"
;
var
inputFileUpload
;
const
idCustomFileUpload
=
"custom-fileUpload"
;
var
btnCustomFileUpload
;
const
idBtnSubmit
=
"btnSubmit"
;
var
btnSubmit
;
...
...
@@ -30,6 +32,7 @@ var errorRemoveBackGround = true;
var
unSeulVisage
=
false
;
var
format_correct
=
false
;
const
id_li_OneFace
=
"li-oneface"
;
var
li_OneFace
;
// SCRIPT ====================================================================================
...
...
@@ -47,6 +50,7 @@ $(document).ready(function(){
btnSubmit
=
$
(
"#"
+
idBtnSubmit
);
btnCancel
=
$
(
"#"
+
idCancel
);
Console
=
$
(
"#"
+
idConsole
);
li_OneFace
=
$
(
"#"
+
id_li_OneFace
);
//Si l'on change la photo,
...
...
@@ -83,10 +87,12 @@ $(document).ready(function(){
src
=
data
[
'src'
];
console
.
log
(
'src'
);
errorFormat
=
data
[
'error'
];
Console
.
empty
();
Console
.
append
(
data
[
'message'
]);
var
message
=
data
[
'message'
]
if
(
!
errorFormat
){
format_correct
=
true
;
photoDetourage
(
errorFormat
,
formData
);
photoDetourage
(
formData
);
}
else
{
alert
(
message
)}
})
});
...
...
@@ -139,7 +145,9 @@ $(document).ready(function(){
<h3>Votre adresse électronique sera
${
mailCalcule
}
, vous recevrez votre mot de passe dans les 24 heures.</h3>
</div>
<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>
`
);
...
...
@@ -155,7 +163,8 @@ $(document).ready(function(){
function
sendMail
(){
console
.
log
(
$
(
"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
({
url
:
URL_CHOOSE_MAIL
,
method
:
'POST'
,
...
...
@@ -170,10 +179,10 @@ function sendMail(){
// window.close();
}
async
function
photoDetourage
(
errorFormat
,
formData
){
async
function
photoDetourage
(
formData
){
await
findFaces
(
ID
);
console
.
log
(
"await"
)
if
(
!
errorFormat
){
console
.
log
(
"await"
)
;
if
(
unSeulVisage
){
$
.
ajax
({
//url de la requête
url
:
URL_DETOURAGE
,
...
...
@@ -194,6 +203,7 @@ async function photoDetourage(errorFormat, formData){
$
(
"#img-ID2"
).
attr
(
'src'
,
data
[
'src'
]);
})
}
}
async
function
findFaces
(
idImage
)
{
...
...
@@ -213,38 +223,15 @@ async function findFaces(idImage) {
$
(
"#"
+
idStatut
).
append
(
predictions
.
length
+
" face(s) found!"
);
if
(
predictions
.
length
==
1
){
$
(
"#li-oneface"
).
css
(
'color'
,
'green'
);
li_OneFace
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);
unSeulVisage
=
true
;
}
else
{
$
(
"#li-oneface"
).
css
(
'color'
,
'red'
);}
// 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
{
li_OneFace
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);}
}
else
{
$
(
"#"
+
idStatut
).
empty
();
$
(
"#"
+
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
);
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
...
...
@@ -12,8 +12,10 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
{
$allowed
=
array
(
"jpg"
=>
"image/jpeg"
,
"jpeg"
=>
"image/jpeg"
,
"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
$newfilename
=
$filename
;
...
...
@@ -60,7 +62,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
}
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"
;
}
}
...
...
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