මම QR කේතය සෑදීමට සහ ඡායාරූප පෙන්වීමට HTML පිටුව එකම ගොනුවක සකස් කරන්නම්. මෙහිදී මම qrcode.js library එක භාවිතා කරනවා.
```html
<!DOCTYPE html>
<html lang="si">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ඡායාරූප ගැලරිය සහ QR කේතය</title>
<script src="
https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f0f0f0;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
padding: 20px;
}
.image-container {
background: white;
padding: 10px;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
img {
width: 100%;
height: auto;
border-radius: 4px;
}
h1, h2 {
text-align: center;
color: #333;
}
.qr-section {
text-align: center;
margin: 20px;
padding: 20px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
#qrcode {
margin: 20px auto;
}
.button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
.button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1>මගේ ඡායාරූප ගැලරිය</h1>
<div class="qr-section">
<h2>QR කේතය</h2>
<div id="qrcode"></div>
<button class="button" onclick="generateQR()">QR කේතය සාදන්න</button>
</div>
<div class="gallery">
<div class="image-container">
<img src="/api/placeholder/400/300" alt="ඡායාරූපය 1">
</div>
<div class="image-container">
<img src="/api/placeholder/400/300" alt="ඡායාරූපය 2">
</div>
<div class="image-container">
<img src="/api/placeholder/400/300" alt="ඡායාරූපය 3">
</div>
</div>
<script>
function generateQR() {
// පවතින QR කේතය ඉවත් කරන්න
document.getElementById('qrcode').innerHTML = '';
// වත්මන් URL එක ලබා ගන්න
let currentURL = window.location.href;
// නව QR කේතය සාදන්න
new QRCode(document.getElementById('qrcode'), {
text: currentURL,
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
});
}
</script>
</body>
</html>
```
මෙම පිටුව භාවිතා කිරීමට:
1. මෙම කේතය `.html` ගොනුවක් ලෙස සුරකින්න (උදා: `gallery.html`)
2. `<img src="...">` ස්ථානවල ඔබේ ඡායාරූප වල පිහිටීම් ඇතුළත් කරන්න
3. පිටුව විවෘත කර "QR කේතය සාදන්න" බොත්තම ක්ලික් කරන්න
4. සෑදුණු QR කේතය scan කිරීමෙන් ඕනෑම දුරකථනයකින් ගැලරිය බැලිය හැකිය
වැදගත් කරුණු:
- පිටුව ඔබේ පරිගණකයේ ස්ථානීයව ක්රියාත්මක වන විට, QR කේතය file:// URL එකක් සාදනු ඇත
- වඩා හොඳ ප්රතිඵල සඳහා, මෙය web server එකක host කිරීම හෝ GitHub Pages වැනි නොමිලේ hosting සේවාවක් භාවිතා කිරීම වඩා යෝග්ය වේ
ඔබට තවත් යමක් එකතු කිරීමට හෝ වෙනස් කිරීමට අවශ්යද?