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
4e2986ec
Commit
4e2986ec
authored
Mar 27, 2022
by
Okthane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renvoyer_image_requête
parent
1e38c61d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
10 deletions
+14
-10
pierremarque.jpg
img/pierremarque.jpg
+0
-0
pierremarqueNO-BG.png
img_bg/pierremarqueNO-BG.png
+0
-0
index.php
index.php
+3
-4
removeBackground2.php
removeBackground2.php
+10
-2
script.js
script.js
+1
-4
No files found.
img/pierremarque.jpg
0 → 100644
View file @
4e2986ec
19.3 KB
img_bg/pierremarqueNO-BG.png
0 → 100644
View file @
4e2986ec
152 KB
index.php
View file @
4e2986ec
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
<!-- API TenserFlow -->
<!-- API TenserFlow -->
</head>
</head>
<body>
<body>
<div
class=
"site-header-main"
>
<div
class=
"site-header-main"
>
<div
id=
"logo-header"
></div>
<div
id=
"logo-header"
></div>
<div
class=
"site-branding"
>
Titre de la page
</div>
<div
class=
"site-branding"
>
Titre de la page
</div>
...
@@ -55,9 +54,9 @@
...
@@ -55,9 +54,9 @@
const
inpFile
=
document
.
getElementById
(
"fileUpload"
);
const
inpFile
=
document
.
getElementById
(
"fileUpload"
);
const
previewImage
=
document
.
getElementById
(
"img-ID"
);
const
previewImage
=
document
.
getElementById
(
"img-ID"
);
//
inpFile.addEventListener("change", function (){
inpFile
.
addEventListener
(
"change"
,
function
(){
const
file
=
inpFile
.
files
[
0
];
const
file
=
inpFile
.
files
[
0
];
console
.
log
(
"ok"
);
if
(
file
){
if
(
file
){
const
reader
=
new
FileReader
();
const
reader
=
new
FileReader
();
console
.
log
(
"ok"
);
console
.
log
(
"ok"
);
...
@@ -67,7 +66,7 @@
...
@@ -67,7 +66,7 @@
reader
.
readAsDataURL
(
file
);
reader
.
readAsDataURL
(
file
);
}
}
//
});
});
</script>
</script>
</div>
</div>
...
...
removeBackground2.php
View file @
4e2986ec
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
define
(
'WHERE_TO_PUT'
,
'img_bg'
);
define
(
'WHERE_TO_PUT'
,
'img_bg'
);
define
(
'PATH_TO_BG'
,
"img_bg"
);
define
(
'PATH_TO_BG'
,
"img_bg"
);
die
;
require_once
"vendor/autoload.php"
;
require_once
"vendor/autoload.php"
;
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
if
(
$_SERVER
[
"REQUEST_METHOD"
]
==
"POST"
)
...
@@ -40,10 +40,18 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
...
@@ -40,10 +40,18 @@ if($_SERVER["REQUEST_METHOD"] == "POST")
$fp
=
fopen
(
'img_bg/'
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"NO-BG.png"
,
"wb"
);
$fp
=
fopen
(
'img_bg/'
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"NO-BG.png"
,
"wb"
);
fwrite
(
$fp
,
$res
->
getBody
());
fwrite
(
$fp
,
$res
->
getBody
());
fclose
(
$fp
);
$path
=
'img_bg/'
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"NO-BG.png"
;
$type
=
pathinfo
(
$path
,
PATHINFO_EXTENSION
);
$data
=
file_get_contents
(
$path
);
$base64
=
'data:image/'
.
$type
.
';base64,'
.
base64_encode
(
$data
);
$data
=
array
(
$data
=
array
(
"src"
=>
PATH_TO_BG
.
"/"
.
pathinfo
(
$filename
,
PATHINFO_FILENAME
)
.
"NO-BG.png"
"témoin"
=>
"ok"
,
"src"
=>
$base64
);
);
echo
json_encode
(
$data
);
echo
json_encode
(
$data
);
}
}
}
}
}
}
...
...
script.js
View file @
4e2986ec
...
@@ -83,10 +83,7 @@ $(document).ready(function(){
...
@@ -83,10 +83,7 @@ $(document).ready(function(){
//Affichage de la photo
//Affichage de la photo
$
(
"#img-ID2"
).
attr
(
'src'
,
data
[
'src'
]);
$
(
"#img-ID2"
).
attr
(
'src'
,
data
[
'src'
]);
})
})
// $("#img-ID2").attr('src','img_bg\\pierremarqueno-bg.png')
});
});
});
});
// FONCTIONS ================================================================================
// FONCTIONS ================================================================================
...
...
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