-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimglink.html
More file actions
78 lines (70 loc) · 2.73 KB
/
imglink.html
File metadata and controls
78 lines (70 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Google Drive Link Converter</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.card {
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.btn-primary, .btn-success {
width: 100%;
font-weight: bold;
}
.form-control {
border-radius: 5px;
}
.output {
margin-top: 20px;
display: none; /* Hidden by default */
}
</style>
</head>
<body>
<div class="container">
<div class="card bg-white text-center">
<h3 class="mb-3 text-primary">Drive Link Converter</h3>
<p class="text-muted">Convert Google Drive links into direct image URLs</p>
<input type="text" id="driveLink" class="form-control" placeholder="Paste Google Drive Link Here">
<button onclick="convertLink()" class="btn btn-primary mt-3">Convert</button>
<div class="output" id="outputSection">
<p class="mt-3"><strong>Converted Link:</strong></p>
<input type="text" id="outputLink" class="form-control" readonly>
<button id="copyBtn" class="btn btn-success mt-3" onclick="copyLink()">Copy Link</button>
</div>
</div>
</div>
<script>
function convertLink() {
let inputLink = document.getElementById("driveLink").value.trim();
let match = inputLink.match(/[-\w]{25,}/);
if (match) {
let imageId = match[0];
let convertedLink = `https://lh3.googleusercontent.com/d/${imageId}`;
document.getElementById("outputLink").value = convertedLink;
document.getElementById("outputSection").style.display = "block"; // Show output section
} else {
document.getElementById("outputSection").style.display = "none"; // Hide if invalid
}
}
function copyLink() {
let outputField = document.getElementById("outputLink");
outputField.select();
navigator.clipboard.writeText(outputField.value);
alert("Link copied to clipboard!");
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>