I am using html2canvas div to images converted, then images post to php, this process is only executed below 700kb images only, 700kb < size images cannot post in php. Please give some ideas and sample code.
my html code is:
<div id="popup_div">
<h1>i put some special</h1>
</div>
<form method="POST" enctype="multipart/form-data" action="work_cards.php" id="myForm">
<input type="hidden" name="img_val" id="img_val" value="" />
</form>
my query:
function capture() {
$('#popup_div').html2canvas({
useCORS: true,
allowTaint: true,
onrendered: function (canvas) {
//Set hidden field's value to image data (base-64 string)
$('#img_val').val(canvas.toDataURL("image/jpeg").replace("image/jpeg", "image/octet-stream"));
//Submit the form manually
document.getElementById("myForm").submit();
}
});
}
work_cards.php code is:
$filteredData=substr($_POST['img_val'], strpos($_POST['img_val'], ",")+1);
//Decode the string
$unencodedData=base64_decode($filteredData);
$url = "Kings_design";
//Save the image
file_put_contents('img/order/'.$url.'.jpeg', $unencodedData);
echo $_POST['img_val'];