| Server IP : 157.230.181.24 / Your IP : 216.73.217.11 Web Server : Apache/2.4.58 (Ubuntu) System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64 User : ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/vhosts/dev-conductive-digital/public/moose/ |
Upload File : |
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Canvas Export Test</title>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Define the canvas
const canvas = document.querySelector('canvas');
// Create the form
const form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', '#');
form.setAttribute('target', '_blank');
canvas.parentNode.insertBefore(form, canvas.nextSibling);
// Create hidden input for the data
const imageData = document.createElement('input');
imageData.setAttribute('type', 'hidden');
imageData.setAttribute('name', 'imageData');
form.appendChild(imageData);
// Add a button for saving (may not be necessary in final build, can also call form.submit())
const button = document.createElement('button');
button.setAttribute('type', 'submit');
button.addEventListener('click', () => {
const data = canvas.toDataURL('image/png');
imageData.setAttribute('value', data);
form.submit();
});
form.parentNode.insertBefore(button, form.nextSibling);
const img = document.querySelector('img');
// User agent detection
const ua = window.navigator.userAgent;
const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);
const webkit = !!ua.match(/WebKit/i);
const firefox = !!ua.match(/FxiOS/i);
const iOSSafari = iOS && webkit && !firefox && !ua.match(/CriOS/i);
const uaString = document.createElement('div');
uaString.innerHTML = ua;
// button.parentNode.insertBefore(uaString, button);
if (iOSSafari) {
button.innerHTML = 'Save for mobile Safari';
form.action = "https://dev.conductive.digital/moose/save-image.php";
} else {
button.innerHTML = 'Save for mobile Chrome/Firefox';
form.action = "https://dev.conductive.digital/moose/show-image.php";
}
// Add image to canvas
img.addEventListener('load', () => {
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0, 375, 553);
});
});
</script>
</head>
<body>
<img src="moose.png" width="375" height="553" style="display: none;" alt="Moose on the Loose">
<canvas id="canvas" width="375" height="553"></canvas>
</body>