I have found this to make a screenshot. It works fine - opens a new Tab - and on click you can download the screenshot.
But I need the screenshot in a folder on my server - that I can work with it with php image commands
How should I do that?
function takeScreenshot() {
// open in new window like this
//
var w = window.open('', '');
w.document.title = "Screenshot";
//w.document.body.style.backgroundColor = "red";
var img = new Image();
// Without 'preserveDrawingBuffer' set to true, we must render now
renderer.render(scene, camera);
renderer.clearDepth();
renderer.render(sceneOrtho, cameraOrtho);
img.src = renderer.domElement.toDataURL();
w.document.body.appendChild(img);
isUserInteracting = false;
}
This did not work for me - but it gave me the decisive information I needed
Did not expect that img.src.toString() would work but surprise - it worked
function takeScreenshot() {
var w = window.open('', '');
w.document.title = "Screenshot";
var img = new Image();
renderer.render(scene, camera);
renderer.clearDepth();
renderer.render(sceneOrtho, cameraOrtho);
img.src = renderer.domElement.toDataURL();
w.document.body.appendChild(img);
let dum = img.src.toString();
let data = new FormData();
data.append("screenshot_data", dum);
let xhr = (window.XMLHttpRequest) ? new XMLHttpRequest() : new activeXObject("Microsoft.XMLHTTP");
xhr.open('POST', 'screenshot_create.php', true);
xhr.send(data);
isUserInteracting = false;
}