Files
hostpioneers/photo-viewer/index.html
T

200 lines
5.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>📸 Photo Viewer - Horus AI</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
min-height: 100vh;
color: #fff;
padding: 20px;
}
.container { max-width: 1000px; margin: 0 auto; }
h1 {
text-align: center;
font-size: 2rem;
margin-bottom: 20px;
background: linear-gradient(90deg, #ffd700, #f59e0b);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.upload-area {
background: rgba(255,255,255,0.05);
border: 2px dashed #6366f1;
border-radius: 16px;
padding: 40px;
text-align: center;
margin-bottom: 30px;
cursor: pointer;
transition: all 0.3s;
}
.upload-area:hover { border-color: #818cf8; background: rgba(255,255,255,0.08); }
.upload-icon { font-size: 3rem; margin-bottom: 10px; }
.upload-text { color: #94a3b8; }
.image-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 20px;
}
.image-card {
background: rgba(255,255,255,0.05);
border-radius: 12px;
overflow: hidden;
border: 1px solid rgba(255,255,255,0.1);
transition: transform 0.3s;
}
.image-card:hover { transform: scale(1.03); }
.image-card img {
width: 100%;
height: 150px;
object-fit: cover;
}
.image-card .caption {
padding: 12px;
font-size: 0.9rem;
color: #94a3b8;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.9);
z-index: 1000;
justify-content: center;
align-items: center;
}
.modal.show { display: flex; }
.modal img {
max-width: 90%;
max-height: 90%;
border-radius: 8px;
}
.modal-close {
position: absolute;
top: 20px;
right: 20px;
font-size: 2rem;
color: #fff;
cursor: pointer;
background: none;
border: none;
}
.share-box {
background: rgba(255,255,255,0.05);
border-radius: 12px;
padding: 20px;
margin-bottom: 30px;
}
.share-box h3 { margin-bottom: 15px; color: #ffd700; }
.share-url {
display: flex;
gap: 10px;
}
.share-url input {
flex: 1;
padding: 12px;
border-radius: 8px;
border: 1px solid #333;
background: #0f172a;
color: #fff;
font-size: 1rem;
}
.share-url button {
padding: 12px 24px;
background: #6366f1;
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
font-weight: bold;
}
.share-url button:hover { background: #818cf8; }
input[type="file"] { display: none; }
</style>
</head>
<body>
<div class="container">
<h1>📸 Photo Viewer - Share with Horus</h1>
<div class="share-box">
<h3>🔗 Share via URL</h3>
<div class="share-url">
<input type="text" id="imageUrl" placeholder="Paste image URL here...">
<button onclick="loadFromUrl()">Load Image</button>
</div>
</div>
<div class="upload-area" onclick="document.getElementById('fileInput').click()">
<div class="upload-icon">📁</div>
<p class="upload-text">Click to upload image or drag & drop</p>
<p style="color:#666; font-size:0.85rem; margin-top:10px;">Supports: JPG, PNG, GIF, WebP</p>
</div>
<input type="file" id="fileInput" accept="image/*" onchange="handleFile(this.files[0])">
<div class="image-grid" id="gallery"></div>
</div>
<div class="modal" id="modal" onclick="closeModal()">
<button class="modal-close">×</button>
<img id="modalImg" src="" alt="Full size">
</div>
<script>
let images = [];
function loadFromUrl() {
const url = document.getElementById('imageUrl').value.trim();
if (url) {
addImage(url, 'URL Image');
document.getElementById('imageUrl').value = '';
}
}
function handleFile(file) {
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
addImage(e.target.result, file.name);
};
reader.readAsDataURL(file);
}
}
function addImage(src, caption) {
images.unshift({ src, caption });
renderGallery();
}
function renderGallery() {
const gallery = document.getElementById('gallery');
gallery.innerHTML = images.map((img, i) => `
<div class="image-card" onclick="openModal(${i})">
<img src="${img.src}" alt="${img.caption}">
<div class="caption">${img.caption}</div>
</div>
`).join('');
}
function openModal(index) {
document.getElementById('modalImg').src = images[index].src;
document.getElementById('modal').classList.add('show');
}
function closeModal() {
document.getElementById('modal').classList.remove('show');
}
</script>
</body>
</html>