Files
Unified_Dashboard_Suite_Go/web/image-merger/index.html
T

916 lines
33 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>Image Merger Pro</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
background: #0a0118;
min-height: 100vh;
padding: 20px;
position: relative;
overflow-x: hidden;
}
/* Animated gradient background - ORANGE/AMBER */
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(-45deg, #7c2d12, #ea580c, #fb923c, #fdba74, #7c2d12);
background-size: 400% 400%;
animation: gradientShift 15s ease infinite;
opacity: 0.15;
z-index: 0;
}
@keyframes gradientShift {
0%, 100% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
}
.container {
max-width: 1400px;
margin: 0 auto;
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(30px) saturate(180%);
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 30px;
box-shadow: 0 20px 60px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
overflow: hidden;
position: relative;
z-index: 10;
animation: fadeInUp 0.8s ease;
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.header {
background: linear-gradient(135deg, #ea580c, #fb923c);
color: white;
padding: 30px;
text-align: center;
position: relative;
box-shadow: 0 4px 20px rgba(234, 88, 12, 0.3);
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
font-weight: 800;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
animation: titleGlow 3s ease-in-out infinite;
}
@keyframes titleGlow {
0%, 100% { filter: drop-shadow(0 0 20px rgba(251, 146, 60, 0.5)); }
50% { filter: drop-shadow(0 0 30px rgba(234, 88, 12, 0.8)); }
}
.content {
display: grid;
grid-template-columns: 300px 1fr;
gap: 20px;
padding: 30px;
}
.sidebar {
display: flex;
flex-direction: column;
gap: 20px;
}
.upload-section {
background: rgba(255, 255, 255, 0.05);
padding: 20px;
border-radius: 16px;
border: 2px dashed #fb923c;
transition: all 0.3s ease;
}
.upload-section:hover {
border-color: #ea580c;
background: rgba(251, 146, 60, 0.1);
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(234, 88, 12, 0.2);
}
.upload-section h3 {
margin-bottom: 15px;
color: #fef3c7;
font-weight: 700;
}
.file-input-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
width: 100%;
margin-bottom: 10px;
}
.file-input-wrapper input[type=file] {
position: absolute;
left: -9999px;
}
.file-input-label {
display: block;
padding: 12px;
background: linear-gradient(135deg, #ea580c, #fb923c);
color: white;
text-align: center;
border-radius: 10px;
cursor: pointer;
transition: all 0.3s ease;
font-weight: 600;
box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
}
.file-input-label:hover {
background: linear-gradient(135deg, #c2410c, #ea580c);
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(234, 88, 12, 0.5);
}
.controls {
background: rgba(255, 255, 255, 0.05);
padding: 20px;
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.controls h3 {
color: #fef3c7;
font-weight: 700;
margin-bottom: 15px;
}
.control-group {
margin-bottom: 20px;
}
.control-group label {
display: block;
margin-bottom: 8px;
color: #fed7aa;
font-weight: 600;
}
.control-group input[type=range] {
width: 100%;
margin-bottom: 5px;
}
.value-display {
font-size: 0.9em;
color: #fdba74;
}
.canvas-container {
position: relative;
background: rgba(0, 0, 0, 0.3);
border-radius: 16px;
overflow: hidden;
min-height: 600px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid rgba(255, 255, 255, 0.1);
}
#canvas {
max-width: 100%;
max-height: 600px;
cursor: default;
}
.action-buttons {
display: flex;
gap: 10px;
margin-top: 20px;
}
.btn {
flex: 1;
padding: 12px 24px;
border: none;
border-radius: 10px;
font-size: 1em;
font-weight: 600;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
position: relative;
overflow: hidden;
}
/* Uiverse.io: Shimmer effect */
.btn::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
bottom: -50%;
left: -50%;
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0) 100%);
transform: rotateZ(60deg) translate(-1em, 7.5em);
}
.btn:hover::before {
animation: shimmerBtn 2s ease-in-out;
}
@keyframes shimmerBtn {
to { transform: rotateZ(60deg) translate(1em, -10em); }
}
.btn-primary {
background: linear-gradient(135deg, #ea580c, #fb923c);
color: white;
}
.btn-primary:hover {
background: linear-gradient(135deg, #c2410c, #ea580c);
transform: translateY(-2px) scale(1.02);
box-shadow: 0 6px 20px rgba(234, 88, 12, 0.4);
animation: glowPulseOrange 1.5s ease-in-out infinite;
}
@keyframes glowPulseOrange {
0%, 100% { box-shadow: 0 6px 20px rgba(234, 88, 12, 0.4); }
50% { box-shadow: 0 10px 30px rgba(234, 88, 12, 0.6); }
}
.btn-secondary {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
color: white;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
transform: translateY(-2px);
}
.image-preview {
width: 100%;
height: 80px;
object-fit: cover;
border-radius: 5px;
margin-top: 10px;
display: none;
}
.image-preview.visible {
display: block;
}
.info {
background: rgba(251, 146, 60, 0.15);
padding: 15px;
border-radius: 16px;
border-left: 4px solid #ea580c;
backdrop-filter: blur(10px);
}
.info h4 {
color: #fb923c;
margin-bottom: 10px;
font-weight: 700;
}
.info ul {
list-style: none;
font-size: 0.9em;
color: #fed7aa;
}
.info li {
margin-bottom: 5px;
padding-left: 20px;
position: relative;
}
.info li:before {
content: "→";
position: absolute;
left: 0;
color: #fb923c;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🎨 Image Merger Pro</h1>
<p>Drag, resize, rotate freely with your mouse</p>
</div>
<div class="content">
<div class="sidebar">
<div class="upload-section">
<h3>Background Image</h3>
<div class="file-input-wrapper">
<input type="file" id="bgInput" accept="image/*">
<label for="bgInput" class="file-input-label">Choose Background</label>
</div>
<img id="bgPreview" class="image-preview">
</div>
<div class="upload-section">
<h3>Front Image</h3>
<div class="file-input-wrapper">
<input type="file" id="frontInput" accept="image/*">
<label for="frontInput" class="file-input-label">Choose Front Image</label>
</div>
<img id="frontPreview" class="image-preview">
</div>
<div class="controls">
<h3>Quick Controls</h3>
<div class="control-group">
<label>Opacity: <span id="opacityValue" class="value-display">100%</span></label>
<input type="range" id="opacity" min="0" max="100" value="100">
</div>
<div class="action-buttons">
<button class="btn btn-secondary" onclick="resetTransform()">Reset</button>
<button class="btn btn-primary" onclick="downloadImage()">Download</button>
</div>
</div>
<div class="controls">
<h3>Output Size</h3>
<div class="control-group">
<label>Scale Output: <span id="outputScaleValue" class="value-display">100%</span></label>
<input type="range" id="outputScale" min="10" max="300" value="100" step="10">
</div>
<div class="control-group">
<label>Custom Width (px)</label>
<input type="number" id="customWidth" min="100" max="10000" placeholder="Auto">
</div>
<div class="control-group">
<label>Custom Height (px)</label>
<input type="number" id="customHeight" min="100" max="10000" placeholder="Auto">
</div>
<div style="font-size: 0.85em; color: #666; margin-top: 10px;">
<strong>Original:</strong> <span id="originalSize">-</span><br>
<strong>Output:</strong> <span id="outputSize">-</span>
</div>
</div>
<div class="info">
<h4>Mouse Controls</h4>
<ul>
<li>Drag center to move</li>
<li>Drag corners to resize</li>
<li>Drag top handle to rotate</li>
<li>Scroll wheel to scale</li>
</ul>
</div>
</div>
<div class="canvas-container">
<canvas id="canvas"></canvas>
</div>
</div>
</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
let bgImage = null;
let frontImage = null;
// Transform properties
let transform = {
x: 0,
y: 0,
width: 200,
height: 200,
rotation: 0,
opacity: 1
};
let aspectRatio = 1;
let outputScale = 1;
let customOutputWidth = null;
let customOutputHeight = null;
// Interaction state
let activeHandle = null;
let isDragging = false;
let dragStart = { x: 0, y: 0 };
let transformStart = null;
const HANDLE_SIZE = 12;
const ROTATE_HANDLE_OFFSET = 40;
// Load background image
document.getElementById('bgInput').addEventListener('change', (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
const img = new Image();
img.onload = () => {
bgImage = img;
canvas.width = img.width;
canvas.height = img.height;
document.getElementById('bgPreview').src = event.target.result;
document.getElementById('bgPreview').classList.add('visible');
updateSizeDisplay();
draw();
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
}
});
// Load front image
document.getElementById('frontInput').addEventListener('change', (e) => {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = (event) => {
const img = new Image();
img.onload = () => {
frontImage = img;
aspectRatio = img.width / img.height;
transform.width = img.width;
transform.height = img.height;
transform.x = (canvas.width - img.width) / 2;
transform.y = (canvas.height - img.height) / 2;
document.getElementById('frontPreview').src = event.target.result;
document.getElementById('frontPreview').classList.add('visible');
draw();
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
}
});
// Opacity control
document.getElementById('opacity').addEventListener('input', (e) => {
transform.opacity = e.target.value / 100;
document.getElementById('opacityValue').textContent = e.target.value + '%';
draw();
});
// Output scale control
document.getElementById('outputScale').addEventListener('input', (e) => {
outputScale = e.target.value / 100;
document.getElementById('outputScaleValue').textContent = e.target.value + '%';
customOutputWidth = null;
customOutputHeight = null;
document.getElementById('customWidth').value = '';
document.getElementById('customHeight').value = '';
updateSizeDisplay();
});
// Custom width
document.getElementById('customWidth').addEventListener('input', (e) => {
const val = parseInt(e.target.value);
if (val && val > 0) {
customOutputWidth = val;
if (bgImage) {
customOutputHeight = Math.round(val * (canvas.height / canvas.width));
document.getElementById('customHeight').value = customOutputHeight;
}
updateSizeDisplay();
}
});
// Custom height
document.getElementById('customHeight').addEventListener('input', (e) => {
const val = parseInt(e.target.value);
if (val && val > 0) {
customOutputHeight = val;
if (bgImage) {
customOutputWidth = Math.round(val * (canvas.width / canvas.height));
document.getElementById('customWidth').value = customOutputWidth;
}
updateSizeDisplay();
}
});
function updateSizeDisplay() {
if (!bgImage) {
document.getElementById('originalSize').textContent = '-';
document.getElementById('outputSize').textContent = '-';
return;
}
const origWidth = canvas.width;
const origHeight = canvas.height;
document.getElementById('originalSize').textContent = `${origWidth} × ${origHeight}px`;
let outWidth, outHeight;
if (customOutputWidth && customOutputHeight) {
outWidth = customOutputWidth;
outHeight = customOutputHeight;
} else {
outWidth = Math.round(origWidth * outputScale);
outHeight = Math.round(origHeight * outputScale);
}
document.getElementById('outputSize').textContent = `${outWidth} × ${outHeight}px`;
}
// Get mouse position relative to canvas
function getMousePos(e) {
const rect = canvas.getBoundingClientRect();
const scaleX = canvas.width / rect.width;
const scaleY = canvas.height / rect.height;
return {
x: (e.clientX - rect.left) * scaleX,
y: (e.clientY - rect.top) * scaleY
};
}
// Transform point by rotation
function rotatePoint(px, py, cx, cy, angle) {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
const dx = px - cx;
const dy = py - cy;
return {
x: cx + dx * cos - dy * sin,
y: cy + dx * sin + dy * cos
};
}
// Inverse transform point
function inverseRotatePoint(px, py, cx, cy, angle) {
return rotatePoint(px, py, cx, cy, -angle);
}
// Get handle positions
function getHandles() {
const cx = transform.x + transform.width / 2;
const cy = transform.y + transform.height / 2;
const angle = transform.rotation;
const corners = [
{ x: transform.x, y: transform.y, cursor: 'nw-resize', type: 'nw' },
{ x: transform.x + transform.width, y: transform.y, cursor: 'ne-resize', type: 'ne' },
{ x: transform.x + transform.width, y: transform.y + transform.height, cursor: 'se-resize', type: 'se' },
{ x: transform.x, y: transform.y + transform.height, cursor: 'sw-resize', type: 'sw' }
];
const rotateHandle = {
x: transform.x + transform.width / 2,
y: transform.y - ROTATE_HANDLE_OFFSET,
cursor: 'grab',
type: 'rotate'
};
// Rotate all handles
const rotated = corners.map(h => ({
...rotatePoint(h.x, h.y, cx, cy, angle),
cursor: h.cursor,
type: h.type
}));
const rotatedRotateHandle = {
...rotatePoint(rotateHandle.x, rotateHandle.y, cx, cy, angle),
cursor: rotateHandle.cursor,
type: rotateHandle.type
};
return [...rotated, rotatedRotateHandle];
}
// Check if mouse is over handle
function getHandleAtPoint(x, y) {
const handles = getHandles();
for (let handle of handles) {
const dist = Math.sqrt(Math.pow(x - handle.x, 2) + Math.pow(y - handle.y, 2));
if (dist < HANDLE_SIZE) {
return handle;
}
}
return null;
}
// Check if point is inside transformed image
function isPointInImage(x, y) {
const cx = transform.x + transform.width / 2;
const cy = transform.y + transform.height / 2;
const local = inverseRotatePoint(x, y, cx, cy, transform.rotation);
return local.x >= transform.x &&
local.x <= transform.x + transform.width &&
local.y >= transform.y &&
local.y <= transform.y + transform.height;
}
// Mouse wheel for scaling
canvas.addEventListener('wheel', (e) => {
if (!frontImage) return;
e.preventDefault();
const mouse = getMousePos(e);
if (isPointInImage(mouse.x, mouse.y)) {
const scaleFactor = e.deltaY > 0 ? 0.95 : 1.05;
const cx = transform.x + transform.width / 2;
const cy = transform.y + transform.height / 2;
transform.width *= scaleFactor;
transform.height *= scaleFactor;
transform.x = cx - transform.width / 2;
transform.y = cy - transform.height / 2;
draw();
}
});
// Mouse down
canvas.addEventListener('mousedown', (e) => {
if (!frontImage) return;
const mouse = getMousePos(e);
const handle = getHandleAtPoint(mouse.x, mouse.y);
if (handle) {
activeHandle = handle.type;
isDragging = true;
dragStart = mouse;
transformStart = { ...transform };
canvas.style.cursor = handle.cursor;
} else if (isPointInImage(mouse.x, mouse.y)) {
activeHandle = 'move';
isDragging = true;
dragStart = mouse;
transformStart = { ...transform };
canvas.style.cursor = 'move';
}
});
// Mouse move
canvas.addEventListener('mousemove', (e) => {
const mouse = getMousePos(e);
if (isDragging && frontImage) {
const dx = mouse.x - dragStart.x;
const dy = mouse.y - dragStart.y;
if (activeHandle === 'move') {
transform.x = transformStart.x + dx;
transform.y = transformStart.y + dy;
} else if (activeHandle === 'rotate') {
const cx = transformStart.x + transformStart.width / 2;
const cy = transformStart.y + transformStart.height / 2;
const startAngle = Math.atan2(dragStart.y - cy, dragStart.x - cx);
const currentAngle = Math.atan2(mouse.y - cy, mouse.x - cx);
transform.rotation = transformStart.rotation + (currentAngle - startAngle);
} else {
// Resize from corner - maintain aspect ratio
const cx = transformStart.x + transformStart.width / 2;
const cy = transformStart.y + transformStart.height / 2;
const localStart = inverseRotatePoint(dragStart.x, dragStart.y, cx, cy, transformStart.rotation);
const localMouse = inverseRotatePoint(mouse.x, mouse.y, cx, cy, transformStart.rotation);
const localDx = localMouse.x - localStart.x;
const localDy = localMouse.y - localStart.y;
// Calculate scale based on diagonal distance
let scaleX = 1;
let scaleY = 1;
if (activeHandle === 'se') {
scaleX = (transformStart.width + localDx) / transformStart.width;
scaleY = (transformStart.height + localDy) / transformStart.height;
} else if (activeHandle === 'sw') {
scaleX = (transformStart.width - localDx) / transformStart.width;
scaleY = (transformStart.height + localDy) / transformStart.height;
} else if (activeHandle === 'ne') {
scaleX = (transformStart.width + localDx) / transformStart.width;
scaleY = (transformStart.height - localDy) / transformStart.height;
} else if (activeHandle === 'nw') {
scaleX = (transformStart.width - localDx) / transformStart.width;
scaleY = (transformStart.height - localDy) / transformStart.height;
}
// Use average scale to maintain aspect ratio
const scale = Math.max(0.1, (Math.abs(scaleX) + Math.abs(scaleY)) / 2);
const newWidth = transformStart.width * scale;
const newHeight = transformStart.height * scale;
// Update position to keep center fixed during resize
const oldCx = transformStart.x + transformStart.width / 2;
const oldCy = transformStart.y + transformStart.height / 2;
transform.width = Math.max(20, newWidth);
transform.height = Math.max(20, newHeight);
transform.x = oldCx - transform.width / 2;
transform.y = oldCy - transform.height / 2;
}
draw();
} else if (frontImage) {
// Update cursor based on hover
const handle = getHandleAtPoint(mouse.x, mouse.y);
if (handle) {
canvas.style.cursor = handle.cursor;
} else if (isPointInImage(mouse.x, mouse.y)) {
canvas.style.cursor = 'move';
} else {
canvas.style.cursor = 'default';
}
}
});
// Mouse up
canvas.addEventListener('mouseup', () => {
isDragging = false;
activeHandle = null;
});
canvas.addEventListener('mouseleave', () => {
isDragging = false;
activeHandle = null;
canvas.style.cursor = 'default';
});
// Draw everything
function draw() {
if (!bgImage) return;
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(bgImage, 0, 0);
if (frontImage) {
ctx.save();
const cx = transform.x + transform.width / 2;
const cy = transform.y + transform.height / 2;
ctx.translate(cx, cy);
ctx.rotate(transform.rotation);
ctx.globalAlpha = transform.opacity;
ctx.drawImage(frontImage, -transform.width / 2, -transform.height / 2, transform.width, transform.height);
ctx.restore();
// Draw handles and bounding box
drawHandles();
}
}
function drawHandles() {
const handles = getHandles();
const cx = transform.x + transform.width / 2;
const cy = transform.y + transform.height / 2;
// Draw bounding box
ctx.save();
ctx.strokeStyle = '#fb923c';
ctx.lineWidth = 2;
ctx.setLineDash([5, 5]);
ctx.beginPath();
const corners = handles.slice(0, 4);
ctx.moveTo(corners[0].x, corners[0].y);
for (let i = 1; i < corners.length; i++) {
ctx.lineTo(corners[i].x, corners[i].y);
}
ctx.closePath();
ctx.stroke();
// Draw line to rotate handle
ctx.beginPath();
const topMid = rotatePoint(
transform.x + transform.width / 2,
transform.y,
cx, cy,
transform.rotation
);
ctx.moveTo(topMid.x, topMid.y);
ctx.lineTo(handles[4].x, handles[4].y);
ctx.stroke();
ctx.restore();
// Draw corner handles
for (let i = 0; i < 4; i++) {
ctx.fillStyle = '#ea580c';
ctx.fillRect(handles[i].x - HANDLE_SIZE/2, handles[i].y - HANDLE_SIZE/2, HANDLE_SIZE, HANDLE_SIZE);
ctx.strokeStyle = 'white';
ctx.lineWidth = 2;
ctx.strokeRect(handles[i].x - HANDLE_SIZE/2, handles[i].y - HANDLE_SIZE/2, HANDLE_SIZE, HANDLE_SIZE);
}
// Draw rotate handle
ctx.beginPath();
ctx.arc(handles[4].x, handles[4].y, HANDLE_SIZE/2, 0, Math.PI * 2);
ctx.fillStyle = '#fb923c';
ctx.fill();
ctx.strokeStyle = 'white';
ctx.lineWidth = 2;
ctx.stroke();
}
function resetTransform() {
if (frontImage) {
transform.width = frontImage.width;
transform.height = frontImage.height;
transform.x = (canvas.width - frontImage.width) / 2;
transform.y = (canvas.height - frontImage.height) / 2;
transform.rotation = 0;
transform.opacity = 1;
document.getElementById('opacity').value = 100;
document.getElementById('opacityValue').textContent = '100%';
draw();
}
}
function downloadImage() {
if (!bgImage) {
alert('Please upload a background image first!');
return;
}
// Calculate output dimensions
let outWidth, outHeight;
if (customOutputWidth && customOutputHeight) {
outWidth = customOutputWidth;
outHeight = customOutputHeight;
} else {
outWidth = Math.round(canvas.width * outputScale);
outHeight = Math.round(canvas.height * outputScale);
}
// Create temporary canvas for output
const outputCanvas = document.createElement('canvas');
outputCanvas.width = outWidth;
outputCanvas.height = outHeight;
const outputCtx = outputCanvas.getContext('2d');
// Calculate scale factors
const scaleX = outWidth / canvas.width;
const scaleY = outHeight / canvas.height;
// Draw background
outputCtx.drawImage(bgImage, 0, 0, outWidth, outHeight);
// Draw front image with transformations
if (frontImage) {
outputCtx.save();
const cx = (transform.x + transform.width / 2) * scaleX;
const cy = (transform.y + transform.height / 2) * scaleY;
const scaledWidth = transform.width * scaleX;
const scaledHeight = transform.height * scaleY;
outputCtx.translate(cx, cy);
outputCtx.rotate(transform.rotation);
outputCtx.globalAlpha = transform.opacity;
outputCtx.drawImage(frontImage, -scaledWidth / 2, -scaledHeight / 2, scaledWidth, scaledHeight);
outputCtx.restore();
}
// Download
const link = document.createElement('a');
link.download = `merged-image-${outWidth}x${outHeight}.png`;
link.href = outputCanvas.toDataURL();
link.click();
}
</script>
</body>
</html>