When you visit the site, paste it into the console (overwriting the faulty function).
function getImgData(chartContainer) { var chartArea = chartContainer.getElementsByTagName('svg')[0].parentNode; var svg = chartArea.innerHTML; var doc = chartContainer.ownerDocument; var canvas = doc.createElement('canvas'); canvas.setAttribute('width', chartArea.offsetWidth); canvas.setAttribute('height', chartArea.offsetHeight); canvas.setAttribute( 'style', 'position: absolute; ' + 'top: ' + (-chartArea.offsetHeight * 2) + 'px;' + 'left: ' + (-chartArea.offsetWidth * 2) + 'px;'); doc.body.appendChild(canvas); canvg(canvas, svg); var imgData = canvas.toDataURL("image/png"); canvas.parentNode.removeChild(canvas); return imgData; }
In JS, he searched for iframe bla bla to get svg.
To automatically save an image, you can simply let the program call programmatically.
document.body.addEventListener("load", function() { saveAsImg( document.getElementById("pie_div"));
To save serveride images this post may be useful to save the image server to PNG
Update
Posting images in PHP (index.js)
function saveToPHP( imgdata ) { var script = document.createElement("SCRIPT"); script.setAttribute( 'type', 'text/javascript' ); script.setAttribute( 'src', 'save.php?data=' + imgdata ); document.head.appendChild( script ); } function save() { var canvas = document.getElementById("canvas"),
save.php
<?php
EricG source share