đ¸ Get Direct Direct Image Link (.jpg / .png)
āĻāĻāĻে āϤোāĻŽাāĻĻেāϰ āĻāύ্āϝ āύিā§ে āĻāϞাāĻŽ Image to Direct Link Converter āϏিāϏ্āĻেāĻŽ — āϝেāĻা āĻĻিā§ে āϤুāĻŽি āϤোāĻŽাāϰ āĻŽোāĻŦাāĻāϞ / āĻĒিāϏি āĻĨেāĻে āĻāĻŦি āĻāĻĒāϞোāĻĄ āĻāϰāϞে āϏāϰাāϏāϰি Direct Image URL āĻĒেā§ে āϝাāĻŦে!
āĻāĻি Image to Link.html āϏ্āĻ্āϰিāĻĒ্āĻ, āϝা ImgBB āϏাāϰ্āĻাāϰেāϰ āϏাāĻĨে āĻাāĻ āĻāϰে।
đĨ Main Features
- No API Keys Needed ❌
- No Login/Signup ❌
- No Expiry ⏳
- Unlimited Uploads ✅
- Simple & Clean Direct Link Generator đ
- Preview With Copy Button đ
- Bootstrap Responsive UI đąđģ
đģ Full Working Code (Image to Link.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fixed Direct Image Uploader</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
padding-top: 20px;
background-color: #f8f9fa;
}
.container {
max-width: 450px;
}
.card {
border: none;
box-shadow: 0 4px 8px rgba(0,0,0,.05);
}
.result-box {
background-color: #e9ecef;
padding: 10px;
border-radius: 5px;
word-break: break-all;
margin-top: 15px;
}
</style>
</head>
<body>
<?php
$imageUrl = null;
$message = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['imageFile'])) {
$file = $_FILES['imageFile'];
if ($file['error'] === UPLOAD_ERR_OK) {
$ch = curl_init();
$api_url = 'https://imgbb.com/json';
$cfile = new CURLFile($file['tmp_name'], $file['type'], $file['name']);
$postData = array(
'source' => $cfile,
'type' => 'file',
'action' => 'upload',
'timestamp' => round(microtime(true) * 1000),
'auth_token' => 'try_using_a_generic_token'
);
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; Android 15; moto g45 5G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.7444.171 Mobile Safari/537.36');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Host: imgbb.com']);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curlError = curl_error($ch);
curl_close($ch);
$data = json_decode($response, true);
if ($httpCode === 200 && isset($data['success']) && $data['success']['code'] == 200) {
$imageUrl = $data['image']['url'];
$message = '✅ Image uploaded successfully!';
} else {
$message = '❌ Upload failed. API error or invalid response.';
if (isset($data['success']['message'])) {
$message .= ' Reason: ' . $data['success']['message'];
}
if ($curlError) {
$message .= ' cURL Error: ' . $curlError;
}
if ($httpCode != 200) {
$message .= ' HTTP Status: ' . $httpCode;
}
$message .= ' (API Response: ' . htmlspecialchars($response) . ')';
}
} else {
$message = '⚠️ Error uploading file: ' . $file['error'];
}
}
?>
<div class="container">
<div class="card p-4">
<h2 class="card-title text-center mb-4">đ¸ Direct Image Uploader</h2>
<form method="POST" enctype="multipart/form-data">
<div class="mb-3">
<label for="imageFile" class="form-label">Select Image File</label>
<input type="file" class="form-control" id="imageFile" name="imageFile" accept="image/*" required>
</div>
<button type="submit" class="btn btn-primary w-100">Upload Image</button>
</form>
<?php if ($message): ?>
<hr>
<div class="alert <?php echo ($imageUrl) ? 'alert-success' : 'alert-danger'; ?> mt-3" role="alert" style="font-size: small;">
<?php echo $message; ?>
</div>
<?php if ($imageUrl): ?>
<h5 class="mt-3">đ Direct Image Link:</h5>
<div class="result-box">
<span id="imageLink"><?php echo htmlspecialchars($imageUrl); ?></span>
</div>
<button onclick="copyToClipboard()" class="btn btn-sm btn-outline-secondary mt-2 w-100">đ Copy Link</button>
<h5 class="mt-4">Preview:</h5>
<div class="text-center">
<img src="<?php echo htmlspecialchars($imageUrl); ?>" class="img-fluid rounded" alt="Uploaded Image" style="max-height: 200px;">
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<script>
function copyToClipboard() {
const copyText = document.getElementById("imageLink").textContent;
navigator.clipboard.writeText(copyText).then(() => {
alert("Copied the link: " + copyText);
}).catch(err => {
const textArea = document.createElement("textarea");
textArea.value = copyText;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
alert("Copied the link: " + copyText);
});
}
</script>
</body>
</html>
✔ āĻļেāώ āĻāĻĨা
āĻāĻি āϏāĻŽ্āĻĒূāϰ্āĻŖ āĻĢ্āϰি āϏিāϏ্āĻেāĻŽ। āϤুāĻŽি āϤোāĻŽাāϰ āĻā§েāĻŦāϏাāĻāĻ, āϏ্āĻ্āϰিāĻĒ্āĻ āĻŦা Blogger āĻ āĻŦ্āϝāĻŦāĻšাāϰ āĻāϰāϤে āĻĒাāϰāĻŦে। āĻোāύো Key, Login āĻŦা Expiry āύেāĻ — āĻļুāϧুāĻ āϏāϰāϞ Direct Image Hosting đĨ
Comments
Post a Comment