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
42d1b639
Commit
42d1b639
authored
Apr 01, 2022
by
Okthane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'final'
parent
62cac6a5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
53 deletions
+62
-53
byebye.html
byebye.html
+1
-1
.jpg
img/.jpg
+0
-0
pierremarqueNO-BG.png
img_bg/pierremarqueNO-BG.png
+0
-0
index.php
index.php
+2
-2
removeBackground2.php
removeBackground2.php
+4
-4
script.js
script.js
+52
-43
upload.php
upload.php
+2
-2
web_server.php
web_server.php
+1
-1
No files found.
byebye.html
View file @
42d1b639
...
@@ -8,6 +8,6 @@
...
@@ -8,6 +8,6 @@
<title>
Merci pour votre participation
</title>
<title>
Merci pour votre participation
</title>
</head>
</head>
<body>
<body>
<img
src=
"img/.jpg"
height=
"400px"
>
</body>
</body>
</html>
</html>
\ No newline at end of file
img/.jpg
0 → 100644
View file @
42d1b639
File added
img_bg/pierremarqueNO-BG.png
deleted
100644 → 0
View file @
62cac6a5
152 KB
index.php
View file @
42d1b639
...
@@ -63,8 +63,8 @@
...
@@ -63,8 +63,8 @@
<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
class=
"list-group"
>
<ul
class=
"list-group"
>
<li
id=
"li-oneface"
class=
"list-group-item list-group-item-secondary"
>
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"
class=
"list-group-item list-group-item-secondary"
>
Format (jpg
ou
png)
<span></span></li>
<li
id=
"li-format"
class=
"list-group-item list-group-item-secondary"
>
Format (jpg
/
png)
<span></span></li>
<li
id=
"li-
siz
e"
class=
"list-group-item list-group-item-secondary"
>
Poids (
<
1
Mo
)<
span
></span></li>
<li
id=
"li-
taill
e"
class=
"list-group-item list-group-item-secondary"
>
Poids (
<
1
Mo
)<
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"
>
...
...
removeBackground2.php
View file @
42d1b639
<?php
<?php
// phpinfo();
// phpinfo();
//
echo json_encode(array("test"=>"ok"));
die;
// die;
define
(
'WHERE_TO_PUT'
,
'img_bg'
);
define
(
'WHERE_TO_PUT'
,
'img_bg'
);
define
(
'PATH_TO_BG'
,
"img_bg"
);
define
(
'PATH_TO_BG'
,
"img_bg"
);
define
(
'TEMP'
,
'temp'
);
define
(
'TEMP'
,
'temp'
);
define
(
'KEY'
,
'qtU9bhJqBxu4aYUsjJYJMWXC'
);
define
(
'KEY'
,
'qtU9bhJqBxu4aYUsjJYJMWXC'
);
require_once
"vendor/autoload.php"
;
require_once
"vendor/autoload.php"
;
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
{
{
if
(
isset
(
$_FILES
[
"photo"
])
&&
$_FILES
[
"photo"
][
"error"
]
==
0
)
if
(
isset
(
$_FILES
[
"photo"
])
&&
$_FILES
[
"photo"
][
"error"
]
==
0
)
...
@@ -44,11 +44,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
...
@@ -44,11 +44,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
// $deletefile=unlink(TEMP.'/'.$newfilename);
// $deletefile=unlink(TEMP.'/'.$newfilename);
//On crée et stocke l'image détourée
//On crée et stocke l'image détourée
$fp
=
fopen
(
'img_bg/'
.
pathinfo
(
$newfilename
,
PATHINFO_FILENAME
)
.
"
NO-BG
.png"
,
"wb"
);
$fp
=
fopen
(
'img_bg/'
.
pathinfo
(
$newfilename
,
PATHINFO_FILENAME
)
.
".png"
,
"wb"
);
fwrite
(
$fp
,
$res
->
getBody
());
fwrite
(
$fp
,
$res
->
getBody
());
fclose
(
$fp
);
fclose
(
$fp
);
$path
=
'img_bg/'
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"
NO-BG
.png"
;
$path
=
'img_bg/'
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
".png"
;
$type
=
pathinfo
(
$path
,
PATHINFO_EXTENSION
);
$type
=
pathinfo
(
$path
,
PATHINFO_EXTENSION
);
$data
=
file_get_contents
(
$path
);
$data
=
file_get_contents
(
$path
);
$base64
=
'data:image/'
.
$type
.
';base64,'
.
base64_encode
(
$data
);
$base64
=
'data:image/'
.
$type
.
';base64,'
.
base64_encode
(
$data
);
...
...
script.js
View file @
42d1b639
...
@@ -33,8 +33,8 @@ var errorRemoveBackGround = true;
...
@@ -33,8 +33,8 @@ 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
;
const
id_li_OneFace
=
"li-oneface"
;
var
li_OneFace
;
const
id_li_
Format
=
"li-oneface
"
;
var
li_format
;
const
id_li_
format
=
"li-format
"
;
var
li_format
;
const
id_li_taille
=
"li-
onefac
e"
;
var
li_taille
;
const
id_li_taille
=
"li-
taill
e"
;
var
li_taille
;
// SCRIPT ====================================================================================
// SCRIPT ====================================================================================
...
@@ -60,44 +60,51 @@ $(document).ready(function(){
...
@@ -60,44 +60,51 @@ $(document).ready(function(){
inputFileUpload
.
change
(
function
(){
inputFileUpload
.
change
(
function
(){
unSeulVisage
=
false
;
unSeulVisage
=
false
;
format_correct
=
false
;
format_correct
=
false
;
valide
=
false
;
ImgBG
.
attr
(
"src"
,
""
);
ImgBG
.
attr
(
"src"
,
""
);
li_format
.
removeClass
(
"list-group-item-success list-group-item-danger"
).
addClass
(
"list-group-item-secondary"
);
li_OneFace
.
removeClass
(
" list-group-item-success list-group-item-danger"
).
addClass
(
"list-group-item-secondary"
);
li_taille
.
removeClass
(
" list-group-item-success list-group-item-danger"
).
addClass
(
"list-group-item-secondary"
);
});
});
//Requête pour les vérifications de sécurité & de format
//Requête pour les vérifications de sécurité & de format
$
(
"#form"
).
on
(
"submit"
,
function
(
event
)
{
$
(
"#form"
).
on
(
"submit"
,
function
(
event
)
{
event
.
preventDefault
();
if
(
valide
==
false
)
var
formData
=
new
FormData
(
this
);
{
event
.
preventDefault
();
console
.
log
(
inputFileUpload
.
attr
(
'filename'
));
var
formData
=
new
FormData
(
this
);
console
.
log
(
inputFileUpload
.
attr
(
'filename'
));
//Requête pour vérifier l'intégrité du fichier, ses dimensions
$
.
ajax
({
//Requête pour vérifier l'intégrité du fichier, ses dimensions
$
.
ajax
({
url
:
URL_CHECK_ID
,
method
:
'POST'
,
url
:
URL_CHECK_ID
,
enctype
:
'multipart/form-data'
,
method
:
'POST'
,
data
:
formData
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
cache
:
false
,
cache
:
false
,
dataType
:
"json"
,
dataType
:
"json"
,
contentType
:
false
,
contentType
:
false
,
processData
:
false
processData
:
false
})
})
.
fail
(
function
(
error
){
.
fail
(
function
(
error
){
Console
.
empty
();
Console
.
empty
();
alert
(
"La requête s'est terminée en échec. Infos : "
+
JSON
.
stringify
(
error
));
alert
(
"La requête s'est terminée en échec. Infos : "
+
JSON
.
stringify
(
error
));
})
})
.
done
(
function
(
data
){
.
done
(
function
(
data
){
errorFormat
=
data
[
'error'
];
errorFormat
=
data
[
'error'
];
data
[
'errorMIME'
]?
li_format
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
):
if
(
data
[
'errorMIME'
]){
li_format
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);}
li_format
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);
else
{
li_format
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);}
data
[
'errorSize'
]?
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
):
console
.
log
(
data
[
'errorSize'
])
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);
if
(
data
[
'errorSize'
]){
console
.
log
(
2
);
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);}
if
(
!
errorFormat
){
else
{
console
.
log
(
1
);
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);}
format_correct
=
true
;
if
(
!
errorFormat
){
photoDetourage
(
formData
);
format_correct
=
true
;
}
photoDetourage
(
formData
);
})
}
})}
});
});
...
@@ -112,9 +119,9 @@ $(document).ready(function(){
...
@@ -112,9 +119,9 @@ $(document).ready(function(){
.
done
(
function
(
response
){
.
done
(
function
(
response
){
// let data = JSON.stringify(response);
// let data = JSON.stringify(response);
// $("div#res").append(data);
// $("div#res").append(data);
if
(
!
data
[
"atraiter"
]){
window
.
open
(
URL_END
,
'_self'
);
let
data
=
response
;
let
data
=
response
;
console
.
log
(
data
);
console
.
log
(
data
);
let
studentIdRes
=
data
[
'studentId'
];
let
prenom
=
data
[
'prenom'
];
let
prenom
=
data
[
'prenom'
];
let
nom
=
data
[
'nom'
];
let
nom
=
data
[
'nom'
];
let
mailCalcule
=
data
[
"mailCalcule"
];
let
mailCalcule
=
data
[
"mailCalcule"
];
...
@@ -203,9 +210,9 @@ function sendMail(){
...
@@ -203,9 +210,9 @@ function sendMail(){
}
}
async
function
photoDetourage
(
formData
){
async
function
photoDetourage
(
formData
){
//
await findFaces(ID);
await
findFaces
(
ID
);
//
if(unSeulVisage){
if
(
unSeulVisage
){
if
(
true
){
//
if (true){
$
.
ajax
({
$
.
ajax
({
//url de la requête
//url de la requête
url
:
URL_DETOURAGE
,
url
:
URL_DETOURAGE
,
...
@@ -213,11 +220,12 @@ async function photoDetourage(formData){
...
@@ -213,11 +220,12 @@ async function photoDetourage(formData){
method
:
'POST'
,
method
:
'POST'
,
enctype
:
'multipart/form-data'
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
data
:
formData
,
cache
:
false
,
dataType
:
"json"
,
contentType
:
false
,
cache
:
false
,
processData
:
false
dataType
:
"json"
,
contentType
:
false
,
processData
:
false
})
})
.
done
(
function
(
data
){
.
done
(
function
(
data
){
console
.
log
(
data
);
console
.
log
(
data
);
...
@@ -294,7 +302,8 @@ function get_base64(src){
...
@@ -294,7 +302,8 @@ function get_base64(src){
k=k+1;
k=k+1;
}
}
base_64 = string.slice(k+7);
base_64 = string.slice(k+7);
return base_64;
console.log(base_64)
return base_64;
}
}
...
...
upload.php
View file @
42d1b639
...
@@ -37,12 +37,12 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
...
@@ -37,12 +37,12 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
}
}
}
}
$maxsize
=
1
*
1024
*
1024
;
$maxsize
=
1
*
1024
*
1024
;
if
(
!
(
$file
nam
e
>
$maxsize
))
if
(
!
(
$file
siz
e
>
$maxsize
))
{
{
$errorSize
=
false
;
$errorSize
=
false
;
}
}
}
}
$error
=
$errorMIME
&&
$errorSize
;
$error
=
$errorMIME
||
$errorSize
;
$data
=
array
(
$data
=
array
(
"errorMIME"
=>
$errorMIME
,
"errorMIME"
=>
$errorMIME
,
...
...
web_server.php
View file @
42d1b639
<?php
<?php
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
){
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
){
$data
=
array
(
$data
=
array
(
"
dossier_valide"
=>
fals
e
,
"
atraiter"
=>
tru
e
,
"studentId"
=>
$_POST
[
'studentId'
],
"studentId"
=>
$_POST
[
'studentId'
],
"prenom"
=>
"jean-patrick"
,
"prenom"
=>
"jean-patrick"
,
"nom"
=>
"doe.remifa.sollasi"
,
"nom"
=>
"doe.remifa.sollasi"
,
...
...
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