issue
Browse files- image/javascript/image.js +38 -2
image/javascript/image.js
CHANGED
|
@@ -477,11 +477,47 @@ function downloadFile(fileId) {
|
|
| 477 |
}
|
| 478 |
|
| 479 |
/**
|
| 480 |
-
* View the processed image in a
|
| 481 |
*/
|
| 482 |
function viewImage(fileId) {
|
| 483 |
const completedFile = completedFiles.find(f => f.id === fileId);
|
| 484 |
if (completedFile) {
|
| 485 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
}
|
| 487 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
}
|
| 478 |
|
| 479 |
/**
|
| 480 |
+
* View the processed image in a modal popup
|
| 481 |
*/
|
| 482 |
function viewImage(fileId) {
|
| 483 |
const completedFile = completedFiles.find(f => f.id === fileId);
|
| 484 |
if (completedFile) {
|
| 485 |
+
// Create modal if it doesn't exist
|
| 486 |
+
let modal = document.getElementById('image-view-modal');
|
| 487 |
+
let backdrop = document.getElementById('image-view-backdrop');
|
| 488 |
+
|
| 489 |
+
if (!modal) {
|
| 490 |
+
// Create backdrop
|
| 491 |
+
backdrop = document.createElement('div');
|
| 492 |
+
backdrop.id = 'image-view-backdrop';
|
| 493 |
+
backdrop.style.cssText = 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9998; display: none;';
|
| 494 |
+
backdrop.onclick = closeImageModal;
|
| 495 |
+
document.body.appendChild(backdrop);
|
| 496 |
+
|
| 497 |
+
// Create modal
|
| 498 |
+
modal = document.createElement('div');
|
| 499 |
+
modal.id = 'image-view-modal';
|
| 500 |
+
modal.style.cssText = 'position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; display: none; max-width: 90%; max-height: 90%; background: white; border-radius: 10px; padding: 10px; box-shadow: 0 0 30px rgba(0,0,0,0.5);';
|
| 501 |
+
modal.innerHTML = `
|
| 502 |
+
<button onclick="closeImageModal()" style="position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%; border: none; background: #dc3545; color: white; font-size: 18px; cursor: pointer; z-index: 10000;">×</button>
|
| 503 |
+
<img id="image-view-content" style="max-width: 80vw; max-height: 80vh; display: block; border-radius: 5px;" />
|
| 504 |
+
`;
|
| 505 |
+
document.body.appendChild(modal);
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
// Show modal with image
|
| 509 |
+
document.getElementById('image-view-content').src = completedFile.url;
|
| 510 |
+
modal.style.display = 'block';
|
| 511 |
+
backdrop.style.display = 'block';
|
| 512 |
}
|
| 513 |
}
|
| 514 |
+
|
| 515 |
+
/**
|
| 516 |
+
* Close image view modal
|
| 517 |
+
*/
|
| 518 |
+
function closeImageModal() {
|
| 519 |
+
const modal = document.getElementById('image-view-modal');
|
| 520 |
+
const backdrop = document.getElementById('image-view-backdrop');
|
| 521 |
+
if (modal) modal.style.display = 'none';
|
| 522 |
+
if (backdrop) backdrop.style.display = 'none';
|
| 523 |
+
}
|