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 @@
<title>
Merci pour votre participation
</title>
</head>
<body>
<img
src=
"img/.jpg"
height=
"400px"
>
</body>
</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 @@
<div
id=
conditions
class=
"col-md-3 my-5 d-flex justify-content-center"
>
<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-format"
class=
"list-group-item list-group-item-secondary"
>
Format (jpg
ou
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-format"
class=
"list-group-item list-group-item-secondary"
>
Format (jpg
/
png)
<span></span></li>
<li
id=
"li-
taill
e"
class=
"list-group-item list-group-item-secondary"
>
Poids (
<
1
Mo
)<
span
></span></li>
</ul>
</div>
<div
class=
"col-md-3 my-auto d-flex justify-content-center"
>
...
...
removeBackground2.php
View file @
42d1b639
<?php
// phpinfo();
//
echo json_encode(array("test"=>"ok"));
die;
// die;
define
(
'WHERE_TO_PUT'
,
'img_bg'
);
define
(
'PATH_TO_BG'
,
"img_bg"
);
define
(
'TEMP'
,
'temp'
);
define
(
'KEY'
,
'qtU9bhJqBxu4aYUsjJYJMWXC'
);
require_once
"vendor/autoload.php"
;
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
{
if
(
isset
(
$_FILES
[
"photo"
])
&&
$_FILES
[
"photo"
][
"error"
]
==
0
)
...
...
@@ -44,11 +44,11 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
// $deletefile=unlink(TEMP.'/'.$newfilename);
//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
());
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
);
$data
=
file_get_contents
(
$path
);
$base64
=
'data:image/'
.
$type
.
';base64,'
.
base64_encode
(
$data
);
...
...
script.js
View file @
42d1b639
...
...
@@ -33,8 +33,8 @@ var errorRemoveBackGround = true;
var
unSeulVisage
=
false
;
var
format_correct
=
false
;
const
id_li_OneFace
=
"li-oneface"
;
var
li_OneFace
;
const
id_li_
Format
=
"li-oneface
"
;
var
li_format
;
const
id_li_taille
=
"li-
onefac
e"
;
var
li_taille
;
const
id_li_
format
=
"li-format
"
;
var
li_format
;
const
id_li_taille
=
"li-
taill
e"
;
var
li_taille
;
// SCRIPT ====================================================================================
...
...
@@ -60,44 +60,51 @@ $(document).ready(function(){
inputFileUpload
.
change
(
function
(){
unSeulVisage
=
false
;
format_correct
=
false
;
valide
=
false
;
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
$
(
"#form"
).
on
(
"submit"
,
function
(
event
)
{
event
.
preventDefault
();
var
formData
=
new
FormData
(
this
);
console
.
log
(
inputFileUpload
.
attr
(
'filename'
));
//Requête pour vérifier l'intégrité du fichier, ses dimensions
$
.
ajax
({
url
:
URL_CHECK_ID
,
method
:
'POST'
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
if
(
valide
==
false
)
{
event
.
preventDefault
();
var
formData
=
new
FormData
(
this
);
console
.
log
(
inputFileUpload
.
attr
(
'filename'
));
//Requête pour vérifier l'intégrité du fichier, ses dimensions
$
.
ajax
({
url
:
URL_CHECK_ID
,
method
:
'POST'
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
cache
:
false
,
dataType
:
"json"
,
contentType
:
false
,
processData
:
false
})
.
fail
(
function
(
error
){
Console
.
empty
();
alert
(
"La requête s'est terminée en échec. Infos : "
+
JSON
.
stringify
(
error
));
})
.
done
(
function
(
data
){
errorFormat
=
data
[
'error'
];
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"
);
data
[
'errorSize'
]?
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
):
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);
if
(
!
errorFormat
){
format_correct
=
true
;
photoDetourage
(
formData
);
}
})
cache
:
false
,
dataType
:
"json"
,
contentType
:
false
,
processData
:
false
})
.
fail
(
function
(
error
){
Console
.
empty
();
alert
(
"La requête s'est terminée en échec. Infos : "
+
JSON
.
stringify
(
error
));
})
.
done
(
function
(
data
){
errorFormat
=
data
[
'error'
];
if
(
data
[
'errorMIME'
]){
li_format
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);}
else
{
li_format
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);}
console
.
log
(
data
[
'errorSize'
])
if
(
data
[
'errorSize'
]){
console
.
log
(
2
);
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-success"
).
addClass
(
"list-group-item-danger"
);}
else
{
console
.
log
(
1
);
li_taille
.
removeClass
(
"list-group-item-secondary list-group-item-danger"
).
addClass
(
"list-group-item-success"
);}
if
(
!
errorFormat
){
format_correct
=
true
;
photoDetourage
(
formData
);
}
})}
});
...
...
@@ -112,9 +119,9 @@ $(document).ready(function(){
.
done
(
function
(
response
){
// let data = JSON.stringify(response);
// $("div#res").append(data);
if
(
!
data
[
"atraiter"
]){
window
.
open
(
URL_END
,
'_self'
);
let
data
=
response
;
console
.
log
(
data
);
let
studentIdRes
=
data
[
'studentId'
];
let
prenom
=
data
[
'prenom'
];
let
nom
=
data
[
'nom'
];
let
mailCalcule
=
data
[
"mailCalcule"
];
...
...
@@ -203,9 +210,9 @@ function sendMail(){
}
async
function
photoDetourage
(
formData
){
//
await findFaces(ID);
//
if(unSeulVisage){
if
(
true
){
await
findFaces
(
ID
);
if
(
unSeulVisage
){
//
if (true){
$
.
ajax
({
//url de la requête
url
:
URL_DETOURAGE
,
...
...
@@ -213,11 +220,12 @@ async function photoDetourage(formData){
method
:
'POST'
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
cache
:
false
,
dataType
:
"json"
,
contentType
:
false
,
processData
:
false
cache
:
false
,
dataType
:
"json"
,
contentType
:
false
,
processData
:
false
})
.
done
(
function
(
data
){
console
.
log
(
data
);
...
...
@@ -294,7 +302,8 @@ function get_base64(src){
k=k+1;
}
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")
}
}
$maxsize
=
1
*
1024
*
1024
;
if
(
!
(
$file
nam
e
>
$maxsize
))
if
(
!
(
$file
siz
e
>
$maxsize
))
{
$errorSize
=
false
;
}
}
$error
=
$errorMIME
&&
$errorSize
;
$error
=
$errorMIME
||
$errorSize
;
$data
=
array
(
"errorMIME"
=>
$errorMIME
,
...
...
web_server.php
View file @
42d1b639
<?php
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
){
$data
=
array
(
"
dossier_valide"
=>
fals
e
,
"
atraiter"
=>
tru
e
,
"studentId"
=>
$_POST
[
'studentId'
],
"prenom"
=>
"jean-patrick"
,
"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