Spaces:
Running
Running
Update index.html
Browse files- index.html +8 -9
index.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
| 17 |
|
| 18 |
<body>
|
| 19 |
<h1>Photo Background Removal Tool By WebTech By Rohit.</h1>
|
| 20 |
-
<div id="container" style="background-image: url('
|
| 21 |
<label id="upload-button" for="upload">
|
| 22 |
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
| 23 |
<path fill="#000"
|
|
@@ -25,6 +25,7 @@
|
|
| 25 |
</path>
|
| 26 |
</svg>
|
| 27 |
Click to upload image
|
|
|
|
| 28 |
</label>
|
| 29 |
</div>
|
| 30 |
<label id="status"></label>
|
|
@@ -36,18 +37,16 @@
|
|
| 36 |
function refresh() {
|
| 37 |
window.location.reload(); // Refresh the page
|
| 38 |
}
|
| 39 |
-
|
| 40 |
function downloadBackground() {
|
| 41 |
var container = document.getElementById('container');
|
| 42 |
var backgroundImageUrl = getComputedStyle(container).backgroundImage.slice(5, -2);
|
| 43 |
-
|
| 44 |
// Create a temporary anchor element
|
| 45 |
-
var
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
link.click();
|
| 50 |
-
document.body.removeChild(link);
|
| 51 |
}
|
| 52 |
|
| 53 |
document.getElementById('upload').addEventListener('change', function () {
|
|
|
|
| 17 |
|
| 18 |
<body>
|
| 19 |
<h1>Photo Background Removal Tool By WebTech By Rohit.</h1>
|
| 20 |
+
<div id="container" style="background-image: url('your-image-url.jpg');">
|
| 21 |
<label id="upload-button" for="upload">
|
| 22 |
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
| 23 |
<path fill="#000"
|
|
|
|
| 25 |
</path>
|
| 26 |
</svg>
|
| 27 |
Click to upload image
|
| 28 |
+
<label id="example">(or try example)</label>
|
| 29 |
</label>
|
| 30 |
</div>
|
| 31 |
<label id="status"></label>
|
|
|
|
| 37 |
function refresh() {
|
| 38 |
window.location.reload(); // Refresh the page
|
| 39 |
}
|
| 40 |
+
|
| 41 |
function downloadBackground() {
|
| 42 |
var container = document.getElementById('container');
|
| 43 |
var backgroundImageUrl = getComputedStyle(container).backgroundImage.slice(5, -2);
|
| 44 |
+
|
| 45 |
// Create a temporary anchor element
|
| 46 |
+
var downloadLink = document.createElement('a');
|
| 47 |
+
downloadLink.href = backgroundImageUrl;
|
| 48 |
+
downloadLink.download = 'background_image.jpg';
|
| 49 |
+
downloadLink.click();
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
document.getElementById('upload').addEventListener('change', function () {
|