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
da81ec41
Commit
da81ec41
authored
Mar 18, 2022
by
Okthane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'Fonctionne_pour_les_images_en_local'
parent
df1faec1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
116 additions
and
9 deletions
+116
-9
certif.cer
certif.cer
+27
-0
pierremarque.jpg
img _test/pierremarque.jpg
+0
-0
severinedemarque.jpg
img _test/severinedemarque.jpg
+0
-0
index.php
index.php
+4
-1
pierremarque.jpg
pierremarque.jpg
+0
-0
removeBackground2.php
removeBackground2.php
+50
-0
script.js
script.js
+30
-6
style.css
style.css
+3
-0
upload.php
upload.php
+2
-2
No files found.
certif.cer
0 → 100644
View file @
da81ec41
-----BEGIN CERTIFICATE-----
MIIEjTCCA3WgAwIBAgIRAOYPhbY9iPOmCgAAAAE3i9kwDQYJKoZIhvcNAQELBQAw
RjELMAkGA1UEBhMCVVMxIjAgBgNVBAoTGUdvb2dsZSBUcnVzdCBTZXJ2aWNlcyBM
TEMxEzARBgNVBAMTCkdUUyBDQSAxQzMwHhcNMjIwMjE3MTIxNTQxWhcNMjIwNTEy
MTIxNTQwWjAWMRQwEgYDVQQDDAsqLmdvb2dsZS5mcjBZMBMGByqGSM49AgEGCCqG
SM49AwEHA0IABMhkc2d2t47PWJmLHfmTrzwkd+h0GFWOUEsku/lr8+Wv3GLHzS8x
B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ixw7+RSywtPhbDByZjhYw9euS1fXa70fbetZ
seNIbRs8vGJK7bHizE8JN7NwMkBN/3tdfColaet95QYPz7Tk46HpBwRGJ7vFfED6
or/K8Sm+c5vnKkD6XpeRMEJiF/Ik0DNZJGnFHAnON1onemiz8bZ4Vx346hc2mI9q
TjHd4bDFS99nMNgS1j2roxc=
-----END CERTIFICATE-----
img/pierremarque.jpg
→
img
_test
/pierremarque.jpg
View file @
da81ec41
File moved
img/severinedemarque.jpg
→
img
_test
/severinedemarque.jpg
View file @
da81ec41
File moved
index.php
View file @
da81ec41
...
...
@@ -14,9 +14,12 @@
<script
src=
"script.js"
></script>
<form
id =
"form"
action=
""
method=
""
enctype=
"multipart/form-data"
>
<h2>
Upload Fichier
</h2>
<div
id =
"div-ID"
>
<div
id =
"div-ID"
class=
"div-photo"
>
<canvas
id=
"canvas"
></canvas>
<img
id=
"img-ID"
src=
""
height=
"150em"
/>
<canvas
id=
"canvas"
></canvas>
<img
id=
"img-ID2"
src=
""
height=
"150em"
/>
</div>
<label
for=
"fileUpload"
>
Fichier:
</label>
<input
type=
"file"
name=
"photo"
id=
"fileUpload"
>
...
...
pierremarque.jpg
deleted
100644 → 0
View file @
df1faec1
19.3 KB
r
mbg
2.php
→
r
emoveBackground
2.php
View file @
da81ec41
<?php
// phpinfo();die;
require_once
"vendor/autoload.php"
;
// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
// if($_SERVER["REQUEST_METHOD"] == "POST")
// {
// if(isset($_FILES["photo"]) && $_FILES["photo"]["error"] == 0)
// {
// $allowed = array("jpg" => "image/jpeg", "png" => "image/png");
// $filename = $_FILES["photo"]["name"];
// $filetype = $_FILES["photo"]["type"];
// phpinfo();
define
(
'WHERE_TO_PUT'
,
'img_bg'
);
define
(
'PATH_TO_BG'
,
"img_bg"
);
// die;
require_once
"vendor/autoload.php"
;
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
{
if
(
isset
(
$_FILES
[
"photo"
])
&&
$_FILES
[
"photo"
][
"error"
]
==
0
)
{
$allowed
=
array
(
"jpg"
=>
"image/jpeg"
,
"png"
=>
"image/png"
);
$filename
=
$_FILES
[
"photo"
][
"name"
];
$filetype
=
$_FILES
[
"photo"
][
"type"
];
//
$ext = pathinfo($filename, PATHINFO_EXTENSION);
//
if(array_key_exists($ext, $allowed))
//
{
$client
=
new
GuzzleHttp\Client
();
$ext
=
pathinfo
(
$filename
,
PATHINFO_EXTENSION
);
if
(
array_key_exists
(
$ext
,
$allowed
))
{
$client
=
new
GuzzleHttp\Client
(
[
'verify'
=>
false
]
);
$res
=
$client
->
post
(
'https://api.remove.bg/v1.0/removebg'
,
[
'multipart'
=>
[
[
'name'
=>
'image_file'
,
'contents'
=>
fopen
(
'img
\pierremarque.jpg'
,
'r'
)
'contents'
=>
fopen
(
'img
/'
.
$filename
,
'r'
)
],
[
'name'
=>
'size'
,
...
...
@@ -26,14 +34,17 @@ require_once "vendor/autoload.php";
]
],
'headers'
=>
[
'X-Api-Key'
=>
'
X-Api-Key:
qYXf5PimffLjeH1i5B1rySQw'
'X-Api-Key'
=>
'qYXf5PimffLjeH1i5B1rySQw'
]
]);
$fp
=
fopen
(
"no-bg.png"
,
"wb"
);
$fp
=
fopen
(
'img_bg/'
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"no-bg.png"
,
"wb"
);
fwrite
(
$fp
,
$res
->
getBody
());
fclose
(
$fp
);
// }
// }
// }
$data
=
array
(
"src"
=>
PATH_TO_BG
.
DIRECTORY_SEPARATOR
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"no-bg.png"
);
echo
json_encode
(
$data
);
}
}
}
?>
\ No newline at end of file
script.js
View file @
da81ec41
// VARIABLES
const
URL_CHECK_ID
=
'upload.php'
;
const
URL_DETOURAGE
=
"removeBackground2.php"
const
ID
=
"img-ID"
;
const
canva
=
"canvas"
;
const
idBtnSubmit
=
'btnSubmit'
;
btnSubmit
=
$
(
"#"
+
idBtnSubmit
);
var
src
=
''
;
// SCRIPT
...
...
@@ -27,6 +30,7 @@ $(document).ready(function(){
})
.
done
(
function
(
data
){
console
.
log
(
data
);
src
=
data
[
'src'
];
$
(
"div#div"
).
empty
();
$
(
"div#div"
).
append
(
data
[
'message'
]);
...
...
@@ -34,7 +38,27 @@ $(document).ready(function(){
$
(
"#img-ID"
).
attr
(
'src'
,
data
[
'src'
]);
findFaces
();
})
$
.
ajax
({
//url de la requête
url
:
URL_DETOURAGE
,
method
:
'POST'
,
enctype
:
'multipart/form-data'
,
data
:
formData
,
cache
:
false
,
dataType
:
"json"
,
contentType
:
false
,
processData
:
false
})
.
done
(
function
(
data
){
console
.
log
(
data
);
//Affichage de la photo
$
(
"#img-ID2"
).
attr
(
'src'
,
data
[
'src'
]);
})
// $("#img-ID2").attr('src','img_bg\\pierremarqueno-bg.png')
});
});
...
...
@@ -52,11 +76,11 @@ async function findFaces() {
console
.
log
(
"faces found"
)
console
.
log
(
predictions
);
document
.
getElementById
(
"p-status"
).
innerText
+=
predictions
.
length
+
" face(s) found!"
;
//
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)";
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;
...
...
style.css
0 → 100644
View file @
da81ec41
.div-photo
{
display
:
inline
}
\ No newline at end of file
upload.php
View file @
da81ec41
<?php
<?php
define
(
'PATH_TO_ID'
,
"img"
);
// Vérifier si le formulaire a été soumis
...
...
@@ -34,7 +34,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
}
else
{
move_uploaded_file
(
$_FILES
[
"photo"
][
"tmp_name"
],
PATH_TO_ID
.
"/"
.
$
_FILES
[
"photo"
][
"name"
]
);
move_uploaded_file
(
$_FILES
[
"photo"
][
"tmp_name"
],
PATH_TO_ID
.
"/"
.
$
filename
);
// echo "Votre fichier a été téléchargé avec succès.";
// echo("<br></br>");
// echo "taille de la photo : ".$_FILES["photo"]["size"]." octets";
...
...
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